示例#1
0
        public CardWrapper(
            ICardTypeDataAccess cardTypeDataAccess,
            IImageDataAccess imageDataAccess,
            IHardLinkDataAccess hardLinkDataAccess,
            IPropertyDataAccess propertyDataAccess,
            int cardId,
            int cardTypeId,
            int?primaryImageId)
        {
            _cardType = new PropWrapper <CardType>(
                () => cardTypeDataAccess.Get(cardTypeId));

            _primaryImage = new PropWrapper <Image>(
                () => primaryImageId.HasValue ? imageDataAccess.Get(primaryImageId.Value) : null);

            _additionalImages = new PropWrapper <List <Image> >(
                () => new List <Image>(imageDataAccess.GetByCardId(cardId)));

            _hardLinks = new PropWrapper <List <HardLink> >(
                () => new List <HardLink>(hardLinkDataAccess.GetHardLinksByOriginId(cardId)));

            _referencedBy = new PropWrapper <List <HardLink> >(
                () => new List <HardLink>(hardLinkDataAccess.GetHardLinksByTargetId(cardId)));

            _props = new PropWrapper <List <Property> >(
                () => new List <Property>(propertyDataAccess.GetPropertiesByCardId(cardId)));
        }
示例#2
0
 public CardTypeWrapper(IImageDataAccess imageDataAccess, IPropertyTypeDataAccess propertyTypeDataAccess, int cardTypeId, int imageId)
 {
     Id             = cardTypeId;
     _image         = new PropWrapper <Image>(() => imageDataAccess.Get(imageId));
     _propertyTypes = new PropWrapper <List <PropertyType> >(() =>
                                                             new List <PropertyType>(propertyTypeDataAccess.GetPropertyTypesByCardTypeId(Id.Value)));
 }