Hello, i have two issues regarding UpgradeHandler class:

  1. when i change My model assembly version from 1.0.0.0 to 1.0.0.1, a DomainBuildException beign thrown with "Upgrade of assembly 'Microtech.Infinity5.Model' from version '1.0.0.0' to '1.0.0.1' is not supported." message, although i implemented my own UpgradeHandler and only override CanUpgradeFrom to return true, but i think DataObject.net can't find the handler( which has implemented within the model assembly) and i can't find the reason.

  2. in my application i keep track of all entities and thair properties, currently i do that by loop on each entity type in the model (after building the model) and extract changes. is it possible to do this in my custom UpgradeHandler, by looping on changes and update the database with that changes, if so, how can i get the list of changes (as i can't find any document on how to do that)?

We are using DataObjects.net V4.4.3 Build 9072

thanks.

asked Sep 26 '12 at 07:17

ahmad%20emad's gravatar image

ahmad emad
26292931

edited Sep 26 '12 at 07:41


One Answer:

Hello Ahmad,

  1. This requires more information. Is your upgrade handler registered in DomainConfiguration. If yes, is your upgrade handler ever created and CanUpgradeFrom() ever called?

  2. You could perform any required upgrade actions in OnUpgrade() method. Session and transaction are already created for you. You could use Session.Current to get session in OnUpgrade() method.

answered Sep 26 '12 at 07:40

Denis%20Krjuchkov's gravatar image

Denis Krjuchkov
179325

edited Sep 26 '12 at 07:48

Hello Denis, thanks for your replay, 1. No, i didn't register my UpgradeHandler in DomainConfigration as i read that it will be found automatically by data objects. so should I register it from web.config or from code?

  1. if i do my work within OnUpgrade() method, is there any way to get a list of changes and their types for the current upgrade?
(Sep 26 '12 at 09:42) ahmad emad ahmad%20emad's gravatar image

1) If everything is done right you upgrade handler would be automatically registered just like persistent Entities. However it's useful to check if it really registered, before going further. Make sure also it is public non-abstract and inherits from Xtensive.Orm.Upgrade.UpgradeHandler.

(Sep 27 '12 at 05:22) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

2) Upgrade operates to some abstracted kind of database schema. So it's impossible to get changes for types. You can however inspect UpgradeContext.SchemaDifference and UpgradeContext.SchemaUpgradeActions for schema changes. Generally you should know what was changed between versions. DO work is to provide easy way to change the schema.

(Sep 27 '12 at 05:23) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Hello Denis, the type is registered within the DomainConfiguration, but its never called(no call to my handler constructor or CanUpgradeFrom method ) .

(Sep 29 '12 at 08:57) ahmad emad ahmad%20emad's gravatar image

Please contact support@dataobjects.net for further investigation

(Oct 04 '12 at 07:49) Denis Krjuchkov Denis%20Krjuchkov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×5
×2
×1

Asked: Sep 26 '12 at 07:17

Seen: 4,094 times

Last updated: Oct 04 '12 at 07:49

powered by OSQA