示例#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
        private PropModel GetPropModelForModel3Dest(IPropFactory propFactory)
        {
            PropModel result = new PropModel
                               (
                className: "DestinationModel3",
                namespaceName: "PropBagLib.Tests.AutoMapperSupport",
                deriveFrom: DeriveFromClassModeEnum.Custom,
                targetType: typeof(DestinationModel3),
                propFactory: propFactory,
                propFactoryType: null,
                propModelCache: null,
                typeSafetyMode: PropBagTypeSafetyMode.Tight,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true
                               );

            //result.Namespaces.Add("System");
            result.Namespaces.Add("DRM.PropBag");
            result.Namespaces.Add("DRM.TypeSafePropertyBag");

            // ProductId (Guid - default)
            IPropInitialValueField pivf = PropInitialValueField.UseDefault;

            PropItemModel propItem = new PropItemModel(type: typeof(Guid), name: "ProductId",
                                                       storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                                       initialValueField: pivf);

            result.Add(propItem.PropertyName, propItem);

            // Amount (int - default)
            propItem = new PropItemModel(type: typeof(int), name: "Amount",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);


            // Size (double - default)
            propItem = new PropItemModel(type: typeof(double), name: "Size",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            // Deep (MyModel4 - null)
            pivf = PropInitialValueField.UseNull;

            propItem = new PropItemModel(type: typeof(MyModel4), name: "Deep",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            return(result);
        }
示例#3
0
        public PropModelType GetPropModelForModel5Dest(IPropFactory propFactory, PropModelCacheInterface propModelCache)
        {
            PropModelType result = new PropModel
                                   (
                className: "DestinationModel5",
                namespaceName: "PropBagLib.Tests.PerformanceDb",
                deriveFrom: DeriveFromClassModeEnum.Custom,
                targetType: typeof(DestinationModel5),
                propFactory: propFactory,
                propFactoryType: null,
                propModelCache: null,
                typeSafetyMode: PropBagTypeSafetyMode.Tight,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true
                                   );

            result.Namespaces.Add("System");
            result.Namespaces.Add("DRM.PropBag");
            result.Namespaces.Add("DRM.TypeSafePropertyBag");

            // ProductId (Guid - default)
            IPropInitialValueField pivf = PropInitialValueField.UseDefault;

            PropItemModel propItem = new PropItemModel(type: typeof(Guid), name: "ProductId",
                                                       storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                                       initialValueField: pivf);

            result.Add(propItem.PropertyName, propItem);


            // Business (Business - null)
            pivf = PropInitialValueField.UseNull;

            propItem = new PropItemModel(type: typeof(Business), name: "Business",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);


            // PersonCollection (ObservableCollection<Person> - null)
            propItem = new PropItemModel(type: typeof(ObservableCollection <Person>), name: "PersonCollection",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.ObservableCollection,
                                         initialValueField: pivf, itemType: typeof(Person));
            result.Add(propItem.PropertyName, propItem);

            result.Open();

            propModelCache.Add(result);

            return(result);
        }
示例#4
0
 // Type, Name, StorageStrategy, Kinde and Initial Value -- With ItemType
 public PropItemModel(Type type, string name, PropStorageStrategyEnum storageStrategy,
                      PropKindEnum propKind, IPropInitialValueField initialValueField, Type itemType)
     : this
     (
         type : type,
         name : name,
         storageStrategy : storageStrategy,
         typeIsSolid : true,
         propKind : propKind,
         propTypeInfoField : null,
         initialValueField : initialValueField,
         extraInfo : null,
         comparer : null,
         itemType : itemType,
         binderField : null,
         mapperRequest : null,
         propCreator : null
     )
 {
 }
示例#5
0
        public PropModelType GetPropModelForModel6Dest(IPropFactory propFactory, PropModelCacheInterface propModelCache)
        {
            PropModelType result = new PropModel
                                   (
                className: "DestinationModel6",
                namespaceName: "PropBagLib.Tests.PerformanceDb",
                deriveFrom: DeriveFromClassModeEnum.Custom,
                targetType: typeof(DestinationModel6),
                propFactory: propFactory,
                propFactoryType: null,
                propModelCache: null,
                typeSafetyMode: PropBagTypeSafetyMode.Tight,
                deferMethodRefResolution: true,
                requireExplicitInitialValue: true
                                   );

            result.Namespaces.Add("System");
            result.Namespaces.Add("DRM.PropBag");
            result.Namespaces.Add("DRM.TypeSafePropertyBag");

            // Business (Business - null)
            IPropInitialValueField pivf = PropInitialValueField.UseNull;

            PropItemModel propItem = new PropItemModel(type: typeof(Business), name: "Business",
                                                       storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                                       initialValueField: pivf);

            result.Add(propItem.PropertyName, propItem);

            //// PersonCollection (ObservableCollection<Person> - null)
            //pivf = new PropInitialValueField(initialValue: null,
            //    setToDefault: false, setToUndefined: false, setToNull: true, setToEmptyString: false);

            //propItem = new PropItem(type: typeof(ObservableCollection<Person>), name: "PersonCollection",
            //    hasStore: true, propKind: PropKindEnum.Collection,
            //    propTypeInfoField: null,
            //    initialValueField: pivf,
            //    doWhenChanged: null, extraInfo: null, comparer: null, itemType: typeof(Person));
            //result.Props.Add(propItem);

            // ChildVM (DestinationModel5 - null)
            propItem = new PropItemModel(type: typeof(DestinationModel5), name: "ChildVM",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            // SelectedPerson (Business - null)
            propItem = new PropItemModel(type: typeof(Person), name: "SelectedPerson",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            // WMessage (String - null)
            propItem = new PropItemModel(type: typeof(string), name: "WMessage",
                                         storageStrategy: PropStorageStrategyEnum.Internal, propKind: PropKindEnum.Prop,
                                         initialValueField: pivf);
            result.Add(propItem.PropertyName, propItem);

            result.Open();

            propModelCache.Add(result);

            return(result);
        }