Beispiel #1
0
        private static IProp CookedScalarPropCreatorNoStore <T>(string propertyName2, object initialValue2, bool typeIsSolid2, IPropTemplate propTemplate2)
        {
            // Prop With External Store, or this is a Prop that supplies a Virtual (aka Caclulated) value from an internal source or from LocalBindings
            // This implementation simply creates a Property that will always have the default value for type T.
            IProp <T> prop = new PropNoStore <T>(propertyName2, typeIsSolid2, (IPropTemplate <T>)propTemplate2);

            return(prop);
        }
Beispiel #2
0
        public override IProp <T> CreateWithNoValue <T>
        (
            PropNameType propertyName,
            object extraInfo,
            PropStorageStrategyEnum storageStrategy,
            bool typeIsSolid,
            Func <T, T, bool> comparer,
            bool comparerIsRefEquality,
            Func <string, T> getDefaultValFunc
        )
        {
            IPropTemplate <T> propTemplate = GetPropTemplate <T>(PropKindEnum.Prop, storageStrategy, comparer, comparerIsRefEquality, getDefaultValFunc);

            IProp <T> prop;

            switch (storageStrategy)
            {
            case PropStorageStrategyEnum.Internal:
            {
                // Regular Prop with Internal Storage -- Just don't have a value as yet.
                prop = new Prop <T>(propertyName, typeIsSolid, propTemplate);
                break;
            }

            case PropStorageStrategyEnum.External:
            {
                // Create a Prop that uses an external storage source.
                prop = new PropExternStore <T>(propertyName, extraInfo, typeIsSolid, propTemplate);
                break;
            }

            case PropStorageStrategyEnum.Virtual:
            {
                // This is a Prop that supplies a Virtual (aka Caclulated) value from an internal source or from LocalBindings
                // This implementation simply creates a Property that will always have the default value for type T.
                prop = new PropNoStore <T>(propertyName, typeIsSolid, propTemplate);
                break;
            }

            default:
            {
                throw new InvalidOperationException($"{storageStrategy} is not supported or is not recognized.");
            }
            }

            return(prop);
        }
Beispiel #3
0
        public override IProp <T> CreateWithNoValue <T>
        (
            PropNameType propertyName,
            object extraInfo,
            PropStorageStrategyEnum storageStrategy,
            bool typeIsSolid,
            Func <T, T, bool> comparer,
            bool comparerIsRefEquality,
            Func <string, T> getDefaultValFunc
        )
        {
            IPropTemplate <T> propTemplate = GetPropTemplate <T>(PropKindEnum.Prop, storageStrategy, comparer, comparerIsRefEquality, getDefaultValFunc);

            if (storageStrategy == PropStorageStrategyEnum.Internal)
            {
                propTemplate.PropCreator = CookedScalarPropCreatorNoVal <T>;
            }
            else
            {
                propTemplate.PropCreator = CookedScalarPropCreatorNoStore <T>;
            }

            if (storageStrategy == PropStorageStrategyEnum.Internal)
            {
                // Regular Prop with Internal Storage -- Just don't have a value as yet.
                IProp <T> prop = new Prop <T>(propertyName, typeIsSolid, propTemplate);
                return(prop);
            }
            else
            {
                // Prop With External Store, or this is a Prop that supplies a Virtual (aka Caclulated) value from an internal source or from LocalBindings
                // This implementation simply creates a Property that will always have the default value for type T.
                IProp <T> prop = new PropNoStore <T>(propertyName, typeIsSolid, propTemplate);
                return(prop);
            }
        }
Beispiel #4
0
        public override object Clone()
        {
            PropNoStore <T> result = new PropNoStore <T>(this.PropertyName, TypeIsSolid, this._template);

            return(result);
        }