Ejemplo n.º 1
0
        public bool AddObject <TEntity>(
            TEntity entity
            )
            where TEntity : class
        {
            GetMockObjectSet <TEntity>().AddObject(entity);
            if (ShouldDeferObjectManagement)
            {
                return(true);
            }
            IObjectManager objectManager = entity as IObjectManager;

            if (!ReferenceEquals(objectManager, null))
            {
                objectManager.ObjectFinishedLoading();
            }
            IBusinessLogic businessLogic = entity as IBusinessLogic;

            if (!ReferenceEquals(businessLogic, null))
            {
                businessLogic.OnAddObject(this);
            }

            return(true);
        }
Ejemplo n.º 2
0
        private void OnMaterialized(object sender, ObjectMaterializedEventArgs e)
        {
            IObjectManager objectManager = e.Entity as IObjectManager;

            if (ReferenceEquals(objectManager, null))
            {
                return;
            }
            objectManager.ObjectFinishedLoading(this);
        }