public DataAttribute AddExtendedProperty(DataContainer container, ExtendedProperty extendedProperty) { throw new NotImplementedException(); }
// to be developed: from this line public DataAttribute AddConstraint(ExtendedProperty extendedProperty, Constraint constraint) { throw new NotImplementedException(); }
public ExtendedProperty UpdateExtendedProperty(ExtendedProperty entity) { Contract.Requires(entity != null, "provided entity can not be null"); Contract.Requires(entity.Id >= 0, "provided entity must have a permant ID"); Contract.Ensures(Contract.Result<ExtendedProperty>() != null && Contract.Result<ExtendedProperty>().Id >= 0, "No entity is persisted!"); using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository<ExtendedProperty> repo = uow.GetRepository<ExtendedProperty>(); repo.Put(entity); // Merge is required here!!!! uow.Commit(); } return (entity); }
public DataAttribute RemoveExtendedProperty(ExtendedProperty extendedProperty) { throw new NotImplementedException(); }
public bool DeleteExtendedProperty(ExtendedProperty entity) { Contract.Requires(entity != null); Contract.Requires(entity.Id >= 0); using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository<ExtendedProperty> repo = uow.GetRepository<ExtendedProperty>(); entity = repo.Reload(entity); repo.Delete(entity); uow.Commit(); } // if any problem was detected during the commit, an exception will be thrown! return (true); }
public ExtendedProperty CreateExtendedProperty(string name, string description, DataContainer container, ICollection<Constraint> constraints) { Contract.Requires(!string.IsNullOrWhiteSpace(name)); Contract.Requires(container != null && container.Id >= 0); Contract.Ensures(Contract.Result<ExtendedProperty>() != null && Contract.Result<ExtendedProperty>().Id >= 0); ExtendedProperty e = new ExtendedProperty() { Name = name, Description = description, DataContainer = container, }; //if (constraints != null) // e.Constraints = new List<Constraint>(constraints); using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository<ExtendedProperty> repo = uow.GetRepository<ExtendedProperty>(); repo.Put(e); uow.Commit(); } return (e); }