public AddRecipientsSelectionsHandler(IUnitOfWork unitOfWork, ISelectionFactory selectionFactory, IRecipientFactory recipientFactory, IRecipientRepository recipientRepository, ISelectionRepository selectionRepository, ISharingRepository sharingRepository, ISharingFactory sharingFactory, IValidator[] validator, ICommandHandlerDispatcher commandHandlerDispatcher) { _unitOfWork = unitOfWork; _selectionFactory = selectionFactory; _recipientFactory = recipientFactory; _recipientRepository = recipientRepository; _selectionRepository = selectionRepository; _sharingFactory = sharingFactory; _sharingRepository = sharingRepository; _validator = validator; _commandHandlerDispatcher = commandHandlerDispatcher; }
public object Execute(PropertyInfo property, IContentData contentData, ISelectionFactory selectionFactory) { var result = (IEnumerable <SelectOption>) this._defaultSelectManyStrategy.Execute(property, contentData, selectionFactory); var type = contentData.GetOriginalType(); if (IsCustomContentType(type, property.Name)) { var onlyValue = CustomProperties[type][property.Name]; if (onlyValue) { return(result.Where(x => x.Selected).Select(x => x.Value)); } return(result.Where(x => x.Selected)); } return(result); }
/// <summary> /// Find the first / only object that matches the given criteria. /// </summary> /// <typeparam name="TIdentity">Type of object used to identity the domain object desired.</typeparam> /// <param name="selectionFactory">Factory object that can turn /// the identity object into the appropriate DbCommand.</param> /// <param name="domainObjectFactory">Factory object that can turn the /// returned result set into a domain object.</param> /// <param name="identity">Object that identifies which item to get.</param> /// <returns>The domain object requested, or null if not found.</returns> public TDomainObject FindOne <TIdentity>( ISelectionFactory <TIdentity> selectionFactory, IDomainObjectFactory <TDomainObject> domainObjectFactory, TIdentity identity) { TDomainObject result = default(TDomainObject); using (DbCommand command = selectionFactory.ConstructSelectCommand(db, identity)) { using (IDataReader rdr = db.ExecuteReader(command)) { if (rdr.Read()) { result = domainObjectFactory.Construct(rdr); } } } return(result); }
/// <summary> /// Find all objects that match the given criteria. /// </summary> /// <typeparam name="TIdentity">Type of object used to identify /// the objects to find.</typeparam> /// <param name="selectionFactory">Factory object that can turn the /// identity object into the appropriate DbCommand.</param> /// <param name="domainObjectFactory">Factory object that can turn the /// returned result set into a domain object.</param> /// <param name="identity">Object that identifies which items to get.</param> /// <returns></returns> public List <TDomainObject> Find <TIdentity>( ISelectionFactory <TIdentity> selectionFactory, IDomainObjectFactory <TDomainObject> domainObjectFactory, TIdentity identity) { List <TDomainObject> results = new List <TDomainObject>(); using (DbCommand command = selectionFactory.ConstructSelectCommand(db, identity)) { using (IDataReader rdr = db.ExecuteReader(command)) { while (rdr.Read()) { results.Add(domainObjectFactory.Construct(rdr)); } } } return(results); }
public AddSelectionHandler(IUnitOfWork unitOfWork, ISelectionFactory selectionFactory, IValidator validator) { _unitOfWork = unitOfWork; _selectionFactory = selectionFactory; _validator = validator; }
private static IEnumerable <ISelectItem> GetSelectionOptions(ISelectionFactory selectionFactory, object property) { var options = selectionFactory.GetSelections(property as ExtendedMetadata); return(options); }
private static object GetStructuredData(PropertyInfo property, IContentData contentData, ISelectionFactory selectionFactory) { var selectOptions = GetSelectionOptions(selectionFactory, property); var propertyValue = (string)property.GetValue(contentData); return(GetSelectOptions(propertyValue, selectOptions)); }
public object Execute(PropertyInfo property, IContentData contentData, ISelectionFactory selectionFactory) { return(GetStructuredData(property, contentData, selectionFactory)); }