Print Page | Close Window

Protected Properties cannot be set in 5.2.2

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1487
Printed Date: 16-Apr-2024 at 5:28am


Topic: Protected Properties cannot be set in 5.2.2
Posted By: sebma
Subject: Protected Properties cannot be set in 5.2.2
Date Posted: 21-Sep-2009 at 11:45pm
Hi,
 
I have a protected property and a protected navigation property.
The idea of making them protected is to disallow any direct modifications from other assemblies, like from the UI.
This has always been working in 5.1.0, I am able to set them from within the DomainModel partial class.
 
After porting to 5.2.2, I have exceptions because even my DomainModel partial class cannot set its protected member data.
 
The DomainModel....Designer.cs shows the following property:
    #region SomeProtectedName
    /// <summary>Gets or sets the SomeProtectedName.</summary>
    [Bindable(true, BindingDirection.TwoWay)]
    [Editable(true)]
    [Display(Name="SomeProtectedName", AutoGenerateField=true)]
    [IbVal.ValidateProperty]
    [IbCore.DBDataType(typeof(String))]
    [MsSer.DataMember]
    public String SomeProtectedName {
       get { return SomeProtectedNameEntityProperty.GetValue(this); }
       [global::System.Diagnostics.DebuggerNonUserCode]
      protected set { SomeProtectedNameEntityProperty.SetValue(this, value); }
    }
    #endregion SomeProtectedName
 
Exception "Cannot set property: Password.  It is a readonly property" will be thrown if you attempt to assign it in DomainModel partial class.
 
The DomainModel....Designer.cs shows the following Navigation property:
    #region HeadPerson
    /// <summary>Gets or sets the HeadPerson.</summary>
    [Bindable(false)]
    [Display(AutoGenerateField=false)]
    [MsSer.DataMember]
    [IbEm.RelationProperty("FK_Organisation_HeadPerson", IbEm.QueryDirection.ToRole1)]
    public Person HeadPerson {
       get { return HeadPersonEntityProperty.GetValue(this); }
       [global::System.Diagnostics.DebuggerNonUserCode]
      protected set { HeadPersonEntityProperty.SetValue(this, value); }
    }
    #endregion HeadPerson
 
A null reference exception will be thrown if you attempt to assign it in DomainModel partial class.
 
Is this expected in 5.2.2 ?
 
Regards
Sebastian
 



Replies:
Posted By: kimj
Date Posted: 22-Sep-2009 at 3:22pm
This was not expected or intentional in v 5.2.2, and has been fixed in current bits (v5.2.3 is coming in mid October).



Print Page | Close Window