public void Init(EntityModel model) { if (_initialized) return; _initialized = true; var entInfo = model.GetEntityInfo(EntityType); Util.Check(entInfo != null, "Entity {0} is not part of entity model.", EntityType); if (!string.IsNullOrWhiteSpace(Properties)) MemberMask = EntityMemberMask.Create(entInfo, Properties); }
public void Extend(EntityModel model) { if(model.ModelState != EntityModelState.EntitiesConstructed) return; //Add tracking properties (IDs of UserTransaction records) to all registered entities foreach(var spec in UpdateStampColumns) { foreach(var type in spec.Types) { var entInfo = model.GetEntityInfo(type); if(entInfo == null) { model.App.ActivationLog.Error("Failed to find entity info for type {0}", type); continue; } if(!string.IsNullOrEmpty(spec.CreateIdPropertyName)) { var newMember = new EntityMemberInfo(entInfo, MemberKind.Column, spec.CreateIdPropertyName, typeof(Guid)); newMember.Attributes.Add(new TrackAttribute(TrackingActionType.Created)); } if(!string.IsNullOrEmpty(spec.UpdateIdPropertyName)) { var newMember = new EntityMemberInfo(entInfo, MemberKind.Column, spec.UpdateIdPropertyName, typeof(Guid)); newMember.Attributes.Add(new TrackAttribute(TrackingActionType.Updated)); } }//foreach type }// foreach spec }