Data Portal Versioning Question

Data Portal Versioning Question

Old forum URL: forums.lhotka.net/forums/t/3273.aspx


dagware posted on Thursday, July 26, 2007

I've been thinking about how CSLA works with Data Portals. How do you handle the situation where you need to add a new property to a BO? The property in question isn't critical -- it's nullable in the database, so it doesn't matter if it starts getting populated right away. Do you have to coordinate putting the new Client code in production at the same time as the new Data Portal server? Or can the older BO just ignore the new property when it is deserializing the data?

Thanks.

Dan

RockfordLhotka replied on Thursday, July 26, 2007

The serialization used by the data portal is version sensitive, so you need to keep both in sync.

dagware replied on Thursday, July 26, 2007

Ugh. Sorry to hear that.

-Dan

RockfordLhotka replied on Thursday, July 26, 2007

The good news though, is that there is a solution.

The data portal uses a provider model, where the network channel is implemented using a proxy/host model. The proxy/host pairs I've written use either the BinaryFormatter or the NetDataContractSerializer (WCF) in a version-sensitive mode.

But you can look at Chapter 4 to see how these proxy/host classes are built, and they aren't that hard. You could write your own (in your own assembly) that uses either of those serializers in a less version-sensitive mode.

Then just change your client and host config files to use your proxy/host assembly instead of Csla.dll (and of course your class names, etc) and away you go.

dagware replied on Friday, July 27, 2007

Interesting. Thanks for the suggestions -- I'll look into them.

-Dan

RockfordLhotka replied on Friday, July 27, 2007

Both the BF and NDCS support attributes you can place on fields to indicate they are optional/new.

The BF has a property you can set to tell it not to include the version info in the byte stream. Do that, and it still works the same, but simply doesn't set missing/optional/new fields, and silently drops extra data in the byte stream if there's no corresponding field in the target type.

I'm not entirely sure if the NDCS has a comparable property, but I imagine it does. Just haven't had a need to research it yet...

Copyright (c) Marimer LLC