//public virtual IProp CreateGenFromString(Type typeOfThisProperty, // string value, bool useDefault, // PropNameType propertyName, object extraInfo, // PropStorageStrategyEnum storageStrategy, bool isTypeSolid, PropKindEnum propKind, // Delegate comparer, bool useRefEquality = false, Type itemType = null) //{ // MemConsumptionTracker mct = new MemConsumptionTracker(enabled: false); // if (propKind == PropKindEnum.Prop) // { // CreateScalarProp propCreator = GetPropCreator(typeOfThisProperty); // mct.MeasureAndReport("GetPropCreator", $"for {propertyName}"); // // TODO: This is where strings are parsed to create objects of type T. // // TODO: This needs more work, to say the least. // IProp prop = propCreator(this, haveValue: true, value: value, useDefault: useDefault, propertyName: propertyName, // extraInfo: extraInfo, storageStrategy: storageStrategy, isTypeSolid: isTypeSolid, // comparer: comparer, useRefEquality: useRefEquality, getDefaultValFunc: null); // mct.MeasureAndReport("Ran propCreator to get IProp", $"for {propertyName}"); // return prop; // } // else if (propKind.IsCollection()) // { // CreateCPropFromStringDelegate propCreator = GetCPropFromStringCreator(typeOfThisProperty, itemType); // mct.MeasureAndReport("GetCPropFromStringCreator", $"for {propertyName}"); // IProp prop = propCreator(this, value: value, useDefault: useDefault, propertyName: propertyName, // extraInfo: extraInfo, storageStrategy: storageStrategy, isTypeSolid: isTypeSolid, // comparer: comparer, useRefEquality: useRefEquality); // mct.MeasureAndReport("Ran GetCPropFromStringCreator to get IProp", $"for {propertyName}"); // return prop; // } // else // { // throw new InvalidOperationException($"PropKind = {propKind} is not recognized or is not supported."); // } //} public virtual IProp CreateGenWithNoValue(Type typeOfThisProperty, PropNameType propertyName, object extraInfo, PropStorageStrategyEnum storageStrategy, bool isTypeSolid, PropKindEnum propKind, Delegate comparer, bool useRefEquality = false, Type itemType = null) { MemConsumptionTracker mct = new MemConsumptionTracker(enabled: false); if (propKind == PropKindEnum.Prop) { CreateScalarProp propCreator = GetPropCreator(typeOfThisProperty); mct.MeasureAndReport("GetPropCreator", $"for {propertyName}"); IProp prop = propCreator(this, haveValue: false, value: null, useDefault: false, propertyName: propertyName, extraInfo: extraInfo, storageStrategy: storageStrategy, isTypeSolid: isTypeSolid, comparer: comparer, useRefEquality: useRefEquality, getDefaultValFunc: null); mct.MeasureAndReport("Ran propCreator to get IProp", $"for {propertyName}"); return(prop); } else if (propKind.IsCollection()) { CreateCPropWithNoValueDelegate propCreator = GetCPropWithNoValueCreator(typeOfThisProperty, itemType); IProp prop = propCreator(this, propertyName: propertyName, extraInfo: extraInfo, storageStrategy: storageStrategy, isTypeSolid: isTypeSolid, comparer: comparer, useRefEquality: useRefEquality); return(prop); } else { throw new InvalidOperationException($"PropKind = {propKind} is not recognized or is not supported."); } }
//From Object //protected virtual CreateDsFromIDoCrudDelegate GetCPropCreator(Type collectionType, Type itemType) //{ // CreateEPropFromObjectDelegate result = DelegateCacheProvider.CreateCPropFromObjectCache.GetOrAdd(new TypePair(collectionType, itemType)); // return result; //} #endregion #region CollectionViewSource Prop Creation Methods //// CollectionViewSource //protected virtual CreateCVSPropDelegate GetCVSPropCreator(Type itemType) //{ // CreateCVSPropDelegate result = DelegateCacheProvider.CreateCVSPropCache.GetOrAdd(itemType); // return result; //} //// CollectionView //protected virtual CreateCVPropDelegate GetCVPropCreator(Type itemType) //{ // CreateCVPropDelegate result = DelegateCacheProvider.CreateCVPropCache.GetOrAdd(itemType); // return result; //} #endregion #region DataSource Creation Methods //protected virtual CreateMappedDSPProviderDelegate GetDSPProviderCreator(Type sourceType, Type destinationType) //{ // CreateMappedDSPProviderDelegate result = DelegateCacheProvider.CreateDSPProviderCache.GetOrAdd(new TypePair(sourceType, destinationType)); // return result; //} #endregion #region Scalar Prop Creation Methods // From Object protected virtual CreateScalarProp GetPropCreator(Type typeOfThisValue) { CreateScalarProp result = DelegateCacheProvider.CreateScalarPropCache.GetOrAdd(typeOfThisValue); return(result); }