Explicit change tracking required for the array field warning

Thread is closed for posting
5 posts, 0 answers
  1. Gopal
    Gopal avatar
    20 posts
    Member since:
    Mar 2009

    Posted 03 Mar 2012 Link to this post

     I have created DomainModel (database approach) using OpenAccess Q3 2011, I have table named Employee having column with datatype as varbinary(max). 
    The generated Employee.generated.cs, gives following warning.
    Explicit change tracking required for the array field HumanResource.Employee.employeePhoto. [class=HumanResource.Employee] [field=employeePhoto]
    below is the excerpt from Employee.generated.cs 

    private byte[] employeePhoto; 
    [Column("EmployeePhoto", OpenAccessType = OpenAccessType.LongVarBinary, IsNullable = true, SqlType = "varbinary(max)")] 
    public virtual byte[] EmployeePhoto 


    return this.employeePhoto; 


    this.employeePhoto = value; 


    1. Question: how to over come this issue.
    I have found this link http://www.telerik.com/help/openaccess-orm/openaccess-tasks-howto-explicit-change-tracking.html , but m confuse where exactly i shall write this mentioned codes.

    2. How does OpenAccess handle FileStream? 
    Thank you!
  2. Ralph Waldenmaier
    Ralph Waldenmaier avatar
    202 posts

    Posted 06 Mar 2012 Link to this post

    Hi Gopal,

    When working with arrays, you will always get the warning message you reported by default. You can disable this warning message by setting the VerboseMode for the OpenAccess Enhancer to 2 in the OpenAccess.targets file. See the following example:

    <Target Name="OpenAccessEnhancer" Inputs="@(IntermediateAssembly->'%(FullPath)')" Outputs="@(EnhancementInfoFile)">
        <OpenAccessEnhancer VerboseMode="2" Assembly="@(IntermediateAssembly->'%(FullPath)')" XmlMapping="@(OpenAccessEmbeddedResource)" AttributeMapping="$(CalculatedAttributeMapping)" FluentMapping="$(CalculatedFluentMapping)" KeyFile="$(AssemblyOriginatorKeyFile)" KeyContainer="$(KeyContainerName)" References="@(ReferencePath)" TargetFramework="$(TargetFrameworkVersion)">
            <Output TaskParameter="Version" ItemName="EV"/>
        <Touch AlwaysCreate="true" Files="@(EnhancementInfoFile)" Time="%(IntermediateAssembly.ModifiedTime)"/>
        <Message Text="@(EV)"/>

    You can find the OpenAccess.targets file under C:\Program Files (x86)\MSBuild . Hence you need to reload your solution and rebuild your project in order to have the new settings applied. 

    To you first question. As mentioned in the documentation you need to inform Telerik OpenAccess ORM about changes to the array, if you manipulate the values inside an array. This is because we can not track these changes. To notify OpenAcces about changes for the field, you must call the MakeDirty() method of the Context/Scope. See the following example:
    using (EntitiesModel ctx = new EntitiesModel())
        DomainClass1 dc1 = ctx.DomainClass1.First();
        ctx.MakeDirty(dc1, "_property1");
        dc1.Property1[0] = 1;
     If you just replace the whole array, then you don't need to notify OpenAccess about changes you have made because they are tracked automatically.

    To your second question: This feature is currently not supported with Telerik OpenAccess ORM. How important is this feature for you?

    I hope this information is helpful for you. Do come back if you have any other question.

    All the best,
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
  3. Michael
    Michael avatar
    1 posts
    Member since:
    Mar 2014

    Posted 11 Aug 2014 in reply to Ralph Waldenmaier Link to this post

    I'm having the same problem as Gopal as well.
    Except when I try to change:


    And save the file afterwards to overwrite the old one, it tells me "Access is denied".
    Anyone know how I can override it?

  4. Kristian Nikolov
    Kristian Nikolov avatar
    206 posts

    Posted 13 Aug 2014 Link to this post

    Hello Michael,

    Thank you for contacting us.

    The recommended approach to altering the behavior of the Enhancer would be to make the modification in the MsBuild script of the .csproj or .vbproj file of the project containing your model. You can do this with the following steps:
    1. Right-click on the project and select the Unload Project option.
    2. Right-click on the unloaded project and select the Edit <ProjectName> option.
    3. Nearly at the end of the MsBuild script you will see the import of the OpenAccess.targets file. Before this import, add a new PropertyGroup element containing the EnhancerVerboseMode setting:
        <EnhancerVerboseMode Condition="'$(EnhancerVerboseMode)'==''">2</EnhancerVerboseMode>

    After saving and reloading the project you should no longer see the warning when rebuilding.

    I hope this helps. Should you have any more questions feel free to get back to us in our forums or using the Ticketing System.

    Kristian Nikolov
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
  5. Catalin
    Catalin avatar
    8 posts
    Member since:
    Jun 2015

    Posted 19 Apr 2016 Link to this post


    I have the same problem as mentioned before, however I get the warning even when the table is marked as readonly:

    var cfgBinaryObj = new MappingConfiguration<BinaryObject>();
    cfgBinaryObj.HasProperty(x => x.Id).IsIdentity();
    cfgBinaryObj.MapType(x => new
      Data = x.Data


    where the binary object is like this:

    public class BinaryObject
      public int Id { get; set; }
      public byte[] Data { get; set; }

    For the read-only field there is no need for change tracking therefore the warning is unnecessary. Can I still disable the warning without changing the verbosity?

    If I disable the warning by changing the verbose mode, wouldn't I loose other significant warnings as well?





Back to Top