void OnObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e) { if (e.Entity is ChangeDataCaptureEntity) { ((ChangeDataCaptureEntity)e.Entity).Context = this; } }
private void ObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e) { object entity = e.Entity; if (entity == null) { return; } //Find all properties that are of type DateTime or DateTime? and fix it's kind to Utc; var properties = entity.GetType().GetProperties() .Where(x => x.PropertyType == typeof(DateTime) || x.PropertyType == typeof(DateTime?)); foreach (var property in properties) { var dt = property.PropertyType == typeof(DateTime?) ? (DateTime?)property.GetValue(entity) : (DateTime)property.GetValue(entity); if (dt == null) { continue; } //If the value is not null set the appropriate DateTimeKind; property.SetValue(entity, dt.Value.AsUtc()); } }
void OnObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e) { if (e.Entity is InformationSchemaEntity) { ((InformationSchemaEntity)e.Entity).Context = this; } }
void ObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e) { if (IsEncrypted(e.Entity)) { DecryptEntity(e.Entity); } }
void context_ObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e) { var person = e.Entity as Person; if (person == null) { return; } if (person.Profile == null) { person.Profile = new Profile() { Person = person } } ; } }
private void ObjectContext_ObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e) { IEntity entity = e.Entity as IEntity; if (entity == null) { return; } object context; Type type = e.Entity.GetType(); if (_CachedEntityContext.ContainsKey(type)) { context = _CachedEntityContext[type]; } else { context = this.GetDynamicContext(type); _CachedEntityContext.Add(type, context); } entity.EntityContext = (IEntityQueryContext <IEntity>)context; }
private void OnObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e) { Console.WriteLine("ObjectMaterialized ON"); }
private void ObjectContext_ObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e) { }