コード例 #1
0
 void OnObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e)
 {
     if (e.Entity is ChangeDataCaptureEntity)
     {
         ((ChangeDataCaptureEntity)e.Entity).Context = this;
     }
 }
コード例 #2
0
ファイル: StoreContext.cs プロジェクト: AqueGen/Prozorro
        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());
            }
        }
コード例 #3
0
 void OnObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e)
 {
     if (e.Entity is InformationSchemaEntity)
     {
         ((InformationSchemaEntity)e.Entity).Context = this;
     }
 }
コード例 #4
0
 void ObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e)
 {
     if (IsEncrypted(e.Entity))
     {
         DecryptEntity(e.Entity);
     }
 }
コード例 #5
0
    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
            }
        }
        ;
    }
}
コード例 #6
0
ファイル: DatabaseContext.cs プロジェクト: wulienen/ComBoost
        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;
        }
コード例 #7
0
 private void OnObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e)
 {
     Console.WriteLine("ObjectMaterialized ON");
 }
コード例 #8
0
 private void ObjectContext_ObjectMaterialized(object sender, System.Data.Entity.Core.Objects.ObjectMaterializedEventArgs e)
 {
 }