Пример #1
0
        // Complete
        public PropItemModel
        (
            Type type,
            string name,
            PropStorageStrategyEnum storageStrategy,
            bool typeIsSolid,
            PropKindEnum propKind,
            ITypeInfoField propTypeInfoField,
            IPropInitialValueField initialValueField,
            object extraInfo,
            IPropComparerField comparer,
            Type itemType,
            IPropBinderField binderField,
            IMapperRequest mapperRequest,
            PropCreatorType propCreator
        )
        {
            PropertyType      = type;
            PropertyName      = name;
            ExtraInfo         = extraInfo;
            StorageStrategy   = storageStrategy;
            TypeIsSolid       = typeIsSolid;
            PropKind          = propKind;
            PropTypeInfoField = _propTypeInfoField;
            InitialValueField = initialValueField;
            ComparerField     = comparer;
            _itemType         = itemType;
            _propBinderField  = binderField;
            _mapperRequest    = mapperRequest;
            _propCreator      = propCreator;

            InitialValueCooked = null;
        }
Пример #2
0
        //public static IMapper GetAutoMapper<TSource, TDestination>
        //    (
        //    IMapperRequest mapperRequest,
        //    //ViewModelFactoryInterface viewModelFactory,
        //    IPropBagMapperService propBagMapperService,
        //    out IAutoMapperRequestKey<TSource, TDestination> rawAutoMapperRequest
        //    )
        //    where TDestination : class, IPropBag
        //{
        //    // This is where the PropModel is used to define the Mapper

        //    // TODO: See if we can submit the request earlier; perhaps when the mapper request is created.

        //    Type typeToWrap = mapperRequest.PropModel.TypeToWrap;

        //    // Submit the Mapper Request.
        //    rawAutoMapperRequest = propBagMapperService.SubmitRawAutoMapperRequest<TSource, TDestination>
        //        (mapperRequest.PropModel/*, viewModelFactory*/, typeToWrap, mapperRequest.ConfigPackageName);

        //    // Get the AutoMapper mapping function associated with the mapper request just submitted.
        //    //IPropBagMapperGen genMapper = _propBagMapperService.GetMapper(mapperKey);

        //    IMapper rawAutoMapper = propBagMapperService.GetRawAutoMapper(rawAutoMapperRequest);
        //    return rawAutoMapper;
        //}

        public static IPropBagMapperGen GetAutoMapper
        (
            IMapperRequest mapperRequest,
            IPropBagMapperService propBagMapperService,
            out IPropBagMapperRequestKeyGen propBagMapperRequestKeyGen
        )
        {
            // Submit the Mapper Request. TODO: See if we can submit the request earlier; perhaps when the mapper request is created.
            propBagMapperRequestKeyGen = propBagMapperService.SubmitPropBagMapperRequest(mapperRequest.PropModel, mapperRequest.SourceType, mapperRequest.ConfigPackageName);

            // Get the AutoMapper mapping function associated with the mapper request just submitted.
            IPropBagMapperGen mapperGen = propBagMapperService.GetPropBagMapper(propBagMapperRequestKeyGen);

            return(mapperGen);
        }
Пример #3
0
        public IMapperRequest GetMapperRequest(string resourceKey)
        {
            //string cookedKey = GetResourceKeyWithSuffix(resourceKey);

            if (_mapperRequestCache.TryGetValue(resourceKey, out IMapperRequest value))
            {
                return(value);
            }
            else
            {
                IMapperRequest result = FetchMapperRequest(resourceKey);
                _mapperRequestCache.Add(resourceKey, result);
                return(result);
            }
        }
Пример #4
0
        public IMapperRequest GetMapperRequest(string resourceKey)
        {
            IMapperRequest result = null;

            foreach (IPropModelBuilder propModelBuilder in _propModelBuilders)
            {
                try
                {
                    result = propModelBuilder.GetMapperRequest(resourceKey);
                    break;
                }
                catch
                {
                    // Ignore the exception.
                }
            }

            return(result);
        }
        public static IPropBagMapper <TSource, TDestination> GetAutoMapper <TSource, TDestination>
        (
            IMapperRequest mapperRequest,
            IPropBagMapperService propBagMapperService,
            out IPropBagMapperRequestKey <TSource, TDestination> propBagMapperRequestKey
        )
            where TDestination : class, IPropBag
        {
            // TODO: See if we can submit the request earlier; perhaps when the mapper request is created.
            //Type typeToWrap = mapperRequest.PropModel.TypeToWrap;

            // Submit the Mapper Request.
            propBagMapperRequestKey = propBagMapperService.SubmitPropBagMapperRequest <TSource, TDestination>
                                          (mapperRequest.PropModel, mapperRequest.ConfigPackageName);

            // Get the AutoMapper mapping function associated with the mapper request just submitted.
            IPropBagMapper <TSource, TDestination> propBagMapper = propBagMapperService.GetPropBagMapper <TSource, TDestination>(propBagMapperRequestKey);

            return(propBagMapper);
        }
Пример #6
0
        public static IPropBagMapper <TSource, TDestination> GetAutoMapper <TSource, TDestination>
        (
            IMapperRequest mapperRequest,
            IPropBagMapperService propBagMapperService,
            out IPropBagMapperRequestKey <TSource, TDestination> propBagMapperRequestKey
        )
            where TDestination : class, IPropBag
        {
            // This is where the PropModel is used to define the Mapper

            // TODO: See if we can submit the request earlier; perhaps when the mapper request is created.

            //Type typeToWrap = null; // This should only be used if we are overridding the TypeToWrap value stored in the PropModel.

            // Submit the Mapper Request.
            propBagMapperRequestKey = propBagMapperService.SubmitPropBagMapperRequest <TSource, TDestination>
                                          (mapperRequest.PropModel /*, typeToWrap*/, mapperRequest.ConfigPackageName);

            // Get the AutoMapper mapping function associated with the mapper request just submitted.
            IPropBagMapper <TSource, TDestination> result = propBagMapperService.GetPropBagMapper <TSource, TDestination>(propBagMapperRequestKey);

            return(result);
        }
Пример #7
0
 public ViewManagerProviderKey(LocalBindingInfo bindingInfo, IMapperRequest mapperRequest)
 {
     BindingInfo   = bindingInfo;
     MapperRequest = mapperRequest ?? throw new ArgumentNullException(nameof(mapperRequest));
 }