This project is read-only.
1
Vote

OpenNETCF.ORM.KeyScheme.None fails to save

description

Problem Entities with OpenNETCF.ORM.KeyScheme.None fail to Insert because they fail to get the Identity. Identity was provided (the records are linked to external database's record).

Solution add && keyScheme != KeyScheme.None to if block prior to getting Identity. Normal get value code gets Identity value.
 private void FillEntity(Action<int, object> setter, string entityName, Type itemType, object item, out FieldAttribute identity)
        {
            // The reason for this somewhat convoluted Action parameter is that while the SqlCeUpdateableRecord (from Insert) 
            // and SqlCeResultSet (from Update) both contain a SetValue method, they don't share it on any common
            // interface.  using an Action allows us to share this code anyway.
            identity = null;

            var keyScheme = Entities[entityName].EntityAttribute.KeyScheme;

            foreach (var field in Entities[entityName].Fields)
            {
//new code
                if (field.IsPrimaryKey && keyScheme != KeyScheme.None)
                {

comments