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();
        }
        public void Edit <T>(T obj)
        {
            Class             @class            = this.GetValidatedClass <T>();
            Object            @object           = this.GetValidatedObject(@class, this.GetId <T>(obj));
            ObjectManipulator objectManipulator = new ObjectManipulator(this.requestHandler);

            objectManipulator.BeginEditTransaction <T>(@object.Id);

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

            objectManipulator.CommitTransaction();
        }
Exemple #3
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);
        }
        public void Edit <T>(T @object)
        {
            int id = this.GetId <T>(@object);

            if (id == 0)
            {
                return;
            }

            ObjectManipulator objectManipulator = new ObjectManipulator(this.requestHandler);

            objectManipulator.BeginEditTransaction <T>(id);

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

            objectManipulator.CommitTransaction();
        }