views:

35

answers:

0

My Entity object has user-assigned id key instead of database-generated id. Proxy created by Visual Studio 10 shows the following:

[DataContract(Namespace="http://schemas.datacontract.org/2004/07/Simplet.Web.Models")]
public sealed partial class BusinessType : Entity
{

    [DataMember()]
    [Editable(false, AllowInitialValue=true)]
    [Key()]
    [RoundtripOriginal()]
    public int TypeID
    {
        get
        {
            return this._typeID;
        }
        set
        {
            if ((this._typeID != value))
            {
                this.OnTypeIDChanging(value);
                this.ValidateProperty("TypeID", value);
                this._typeID = value;
                this.RaisePropertyChanged("TypeID");
                this.OnTypeIDChanged();
            }
        }
    }

    ...
}

However in datagrid which binds to that entity I cannot assign id value (probably it is made readonly) after a new entity was added in the following way:

myDomainContext.BusinessTypes.Add(new BusinessType());

What I'm doing wrong?