public void Create <T>(T @object)
        {
            ObjectManipulator objectManipulator = new ObjectManipulator(this.requestHandler);

            objectManipulator.BeginCreateTransaction <T>();

            foreach (PropertyInfo propertyInfo in typeof(T).GetProperties())
            {
                objectManipulator.SetPropertyValue(propertyInfo.Name, propertyInfo.GetValue(@object));
            }

            objectManipulator.CommitTransaction();
        }
示例#2
0
        public void Create <T>(T obj)
        {
            Class             @class            = this.GetValidatedClass <T>();
            ObjectManipulator objectManipulator = new ObjectManipulator(this.requestHandler);

            objectManipulator.BeginCreateTransaction <T>();

            foreach (PropertyInfo propertyInfo in typeof(T).GetProperties())
            {
                objectManipulator.SetPropertyValue(propertyInfo.Name, propertyInfo.GetValue(obj));
            }

            int    objectId = objectManipulator.CommitTransaction();
            Object @object  = this.objectRepository.WithKey(objectId);

            Event <IObjectCreatedEventHandler, IRequestHandler, Object> .Broadcast(this.requestHandler, @object);
        }