Hi, I have a few questions regarding migration from 4.6 to 5.0 (

  1. Where is the documentation regarding Dataobjects 5.0 ? The version online seems to be a copy of 4.6
  2. What do we do with [Transactional] and [NonTransactional] attributes ?
  3. How to upgrade 'enum' columns ? The database columnname seem to have changed in DO 5 from 'Type.MyEnumField' to 'MyEnumField'. Example : I have a type 'Request' with a column 'State' of type 'RequestState' (enum). This column was mapped in SQL in 4.6 as 'Request.State', it is now mapped in SQL in 5.0 as 'State'.
  4. Xtensive.Orm.Security can't upgrade from 4.6 to 5.0 (I fixed it temporarly editing the value in Metadata.Assembly
  5. TransactionScope.Transaction.ValidationContext doesn't exist. What is the replacement ?
  6. Same for Session.Current.DisableValidation(), what is the replacement ?

Others points regarding upgrade tp DO 5.0 I solved already :

  • PropertyConstraintAspect -> PropertyValidator
  • To use Postsharp 2 with DO 5.0, include PostSharp.targets before dataobjects.targets



asked Jan 08 '16 at 11:53

Benoit%20Nesme's gravatar image

Benoit Nesme

One Answer:

Hello Benoit Nesme.

1) In many things documentation of 5.0 is similar to 4.6.

2) TransactionalAttribute and NotTransactionalAttribute are based on PostSharp. Due to PostSharp is no longer in use we removed them. In 5.0.x there is no something simmilar.

3) Enum fields has same names in 5.0 and 4.6. By default enum field Company.CompanyType will generate column with 'CompanyType' name of 'Company' table. Are there any [FieldMapping] attributes on those enum fields? If so, then you can keep mapping. DO might resolve it if names of fields are same. 4) You don't have to do it manually. DO checks registered assemblies. If any version of assemblies then DO try to find upgrader. Write something like

public class SecurityAssemblyUpgradeHandler : UpgradeHandler
    public override Assembly Assembly
      get { return typeof (GenericPrincipal).Assembly; }

public override string AssemblyName
  get { return Assembly.GetName().Name; }

public override bool CanUpgradeFrom(string oldVersion)
  // you can filter specific versions of assembly here.
  // this implementation will be used for upgrade from any versions
  return true;


and don't forget to register it in domain

domainConfiguration.Types.Register(typeof (SecurityAssemblyUpgradeHandler));

Validation framework was reworked very much so, unfortunately, there is no access to ValidationContext (it is another ValidationContext now), also there is no any replacements for Session.DisableValidation(). If field has Constraint it will be validated on transaction committing or on changing of field value.

What for do you use ValidationContext and Session.DisableValidation() in 4.6? Maybe I can find some workaround for you.

answered Jan 11 '16 at 02:20

Alexey%20Kulakov's gravatar image

Alexey Kulakov

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

powered by OSQA