private SchoolRatesGroupsBase EntityResolver( string partitionKey, string rowKey, DateTimeOffset timestamp, IDictionary <string, EntityProperty> properties, string etag) { SchoolRatesGroupsBase toReturn = null; Type baseType = typeof(SchoolRatesGroupsBase); string baseTypeNamespace = baseType.Namespace; // rowKey is the entity type. string typeName = $"{baseTypeNamespace}.{rowKey}"; Type type = Type.GetType(typeName); toReturn = (SchoolRatesGroupsBase)Activator.CreateInstance(type); toReturn.PartitionKey = partitionKey; toReturn.RowKey = rowKey; toReturn.Timestamp = timestamp; toReturn.ETag = etag; toReturn.ReadEntity(properties, null); return(toReturn); }
private TModelsBase ExtractAndMap <TModelsBase, TSchoolRatesGroupsBase>( IList <SchoolRatesGroupsBase> schoolRatesGroupsBases) where TSchoolRatesGroupsBase : SchoolRatesGroupsBase where TModelsBase : DomainModels.ModelsBase { TModelsBase toReturn = null; SchoolRatesGroupsBase schoolRatesGroupsBase = schoolRatesGroupsBases.SingleOrDefault(x => x is TSchoolRatesGroupsBase); if (schoolRatesGroupsBase != null) { TSchoolRatesGroupsBase schoolRatesGroupsBaseTyped = schoolRatesGroupsBase as TSchoolRatesGroupsBase; toReturn = this.mapper.Map <TSchoolRatesGroupsBase, TModelsBase>( schoolRatesGroupsBaseTyped); } return(toReturn); }