/// <summary> /// Gets the naming strategy. /// </summary> /// <param name="componentMapping">The component mapping.</param> /// <returns>A <see cref="Orion.Framework.DataLayer.NH.Domain.IComponentNamingStrategy"/></returns> public static IComponentNamingStrategy GetNamingStrategy(this IComponentMapping componentMapping) { IComponentNamingStrategy componentNamingStrategy = null; var namingAttributes = componentMapping.Member.MemberInfo.GetCustomAttributes( typeof(ComponentNamingStrategyAttribute), false); if (namingAttributes.Count() > 0) { var namingAttribute = namingAttributes[0] as ComponentNamingStrategyAttribute; if (namingAttribute != null) { componentNamingStrategy = namingAttribute.ComponentNamingStrategy; } } var componentType = componentMapping.Member.PropertyType; if (componentNamingStrategy == null) { var classNamingAttributes = componentType.GetCustomAttributes( typeof(ComponentNamingStrategyAttribute), false); if (classNamingAttributes.Count() > 0) { var classNamingAttribute = classNamingAttributes[0] as ComponentNamingStrategyAttribute; if (classNamingAttribute != null) { componentNamingStrategy = classNamingAttribute.ComponentNamingStrategy; } } } return(componentNamingStrategy ?? new ComponentPropertyReplaceStrategy()); }
public override void Visit(IComponentMapping componentMapping) { var writer = new XmlComponentWriter(serviceLocator); var componentXml = writer.Write(componentMapping); document.ImportAndAppendChild(componentXml); }
public override void Visit(IComponentMapping mapping) { var writer = serviceLocator.GetWriter <IComponentMapping>(); var xml = writer.Write(mapping); document.ImportAndAppendChild(xml); }
/// <summary> /// Gets the name of the foreign key. /// </summary> /// <param name="manyToOneMapping">The many to one mapping.</param> /// <param name="componentMapping">The component mapping.</param> /// <param name="entityType">Type of the entity.</param> /// <returns>A <see cref="System.String"/></returns> public static string GetForeignKeyName( this ManyToOneMapping manyToOneMapping, IComponentMapping componentMapping, Type entityType ) { var manyToOnePropertyType = manyToOneMapping.Member.PropertyType; var propertyTypeName = manyToOnePropertyType.Name; if ( typeof( ILookup ).IsAssignableFrom ( manyToOnePropertyType ) ) { propertyTypeName += "Lkp"; } var namingStrategy = componentMapping.GetNamingStrategy (); var columnName = namingStrategy.GetColumnName ( componentMapping.Member.DeclaringType, componentMapping.Member.PropertyType, componentMapping.Name, manyToOneMapping.Member.DeclaringType, manyToOneMapping.Member.PropertyType, manyToOneMapping.Name, true ); var referenceName = string.Format ( "{0}_{1}", entityType.Name, propertyTypeName ); const string ForeignKeyNameSuffix = "_FK"; if ( columnName != propertyTypeName.Replace ( "Lkp", string.Empty ) ) { referenceName = string.Format ( "{0}_{1}_{2}", entityType.Name, propertyTypeName, columnName ); } var foreignKeyName = string.Format ( "{0}{1}", referenceName, ForeignKeyNameSuffix ); return foreignKeyName; }
private static void ProcessSettingNotNullable(IComponentMapping componentMapping) { foreach (var propertyMapping in componentMapping.Properties) { var member = propertyMapping.Member; if (!member.IsDbNullable()) { var column = propertyMapping.Columns.Single(); column.NotNull = true; } } foreach (var manyToOneMapping in componentMapping.References) { var member = manyToOneMapping.Member; if (!member.IsDbNullable()) { foreach (var column in manyToOneMapping.Columns) { column.NotNull = true; } } } foreach (var childComponentMapping in componentMapping.Components) { ProcessSettingNotNullable(childComponentMapping); } }
protected XmlDocument WriteComponent(string element, IComponentMapping mapping) { var doc = new XmlDocument(); var componentElement = doc.AddElement(element); if (mapping.IsSpecified("Name")) { componentElement.WithAtt("name", mapping.Name); } if (mapping.IsSpecified("Insert")) { componentElement.WithAtt("insert", mapping.Insert); } if (mapping.IsSpecified("Update")) { componentElement.WithAtt("update", mapping.Update); } if (mapping.IsSpecified("Access")) { componentElement.WithAtt("access", mapping.Access); } if (mapping.IsSpecified("OptimisticLock")) { componentElement.WithAtt("optimistic-lock", mapping.OptimisticLock); } return(doc); }
protected void BindComponent(IComponentMapping componentMapping, Component model, System.Type reflectedClass, string className, string path, bool isNullable, IDictionary <string, MetaAttribute> inheritedMetas) { model.RoleName = path; inheritedMetas = GetMetas(componentMapping as IDecoratable, inheritedMetas); model.MetaAttributes = inheritedMetas; var componentClassName = componentMapping.Class; if (!string.IsNullOrEmpty(componentClassName)) { model.ComponentClass = ClassForNameChecked(componentClassName, mappings, "component class not found: {0}"); model.ComponentClassName = FullQualifiedClassName(componentClassName, mappings); model.IsEmbedded = false; } else if (componentMapping is HbmDynamicComponent) { model.IsEmbedded = false; model.IsDynamic = true; } else if (reflectedClass != null) { model.ComponentClass = reflectedClass; model.IsEmbedded = false; } else { // an "embedded" component (ids only) model.IsEmbedded = true; if (model.Owner.HasPocoRepresentation) { model.ComponentClass = model.Owner.MappedClass; } else { model.IsDynamic = true; } } string nodeName = !string.IsNullOrEmpty(componentMapping.EmbeddedNode) ? componentMapping.EmbeddedNode : !string.IsNullOrEmpty(componentMapping.Name) ? componentMapping.Name : model.Owner.NodeName; model.NodeName = nodeName; // Parent if (componentMapping.Parent != null && !string.IsNullOrEmpty(componentMapping.Parent.name)) { model.ParentProperty = new Property { Name = componentMapping.Parent.name, PropertyAccessorName = componentMapping.Parent.access ?? mappings.DefaultAccess }; } new PropertiesBinder(Mappings, model, className, path, isNullable, Mappings.Dialect).Bind( componentMapping.Properties, model.Table, inheritedMetas, p => { }, model.AddProperty); }
/// <summary> /// Creates the appropriate Time Dimension Mapping object <see cref="ITimeDimension"/> based on the mapping from the mapping store /// e.g. it will create a different object if TimeDimension is mapped to one column, different if it is mapped two column and different if the column is Date type /// </summary> /// <param name="mapping"> /// The mapping entity<see cref="MappingEntity"/> of the Time Dimension component /// </param> /// <param name="frequencyComponentMapping"> /// The frequency component mapping. /// </param> /// <param name="databaseType"> /// The dissemination database vendor. Is needed to generate the correct SQL query where conditions /// </param> /// <returns> /// An Time Dimension Transcoding object<see cref="ITimeDimension"/> /// </returns> public static ITimeDimension Create(MappingEntity mapping, IComponentMapping frequencyComponentMapping, string databaseType) { ITimeDimension timeDimensionTranscoding = null; if (mapping.Transcoding == null) { timeDimensionTranscoding = new TimeDimensionSingleFrequency(CreateTimeDimensionMapping(mapping, databaseType)); } else if (mapping.Transcoding.TimeTranscodingCollection.Count == 1) { timeDimensionTranscoding = new TimeDimensionSingleFrequency(CreateTranscodedTimeDimensionMapping(mapping, databaseType, mapping.Transcoding.TimeTranscodingCollection.First())); } else if (mapping.Transcoding.TimeTranscodingCollection.Count > 1) { var timeDimensionMappings = new Dictionary <string, ITimeDimensionMapping>(StringComparer.Ordinal); foreach (var transcodingEntity in mapping.Transcoding.TimeTranscodingCollection) { var timeDimensionSubTranscoding = CreateTranscodedTimeDimensionMapping(mapping, databaseType, transcodingEntity); timeDimensionMappings[transcodingEntity.FrequencyValue] = timeDimensionSubTranscoding; } timeDimensionTranscoding = new TimeDimensionMultiFrequency(timeDimensionMappings, frequencyComponentMapping); } if (timeDimensionTranscoding != null) { timeDimensionTranscoding.Component = mapping.Components[0]; timeDimensionTranscoding.Mapping = mapping; } return(timeDimensionTranscoding); }
private void StorePrefix(IComponentMapping mapping) { if (mapping.HasColumnPrefix) { prefixes.Push(mapping.ColumnPrefix.Replace("{property}", mapping.Member.Name)); } }
private void StorePrefix(IComponentMapping mapping) { var referenceMapping = (ReferenceComponentMapping)mapping; if (referenceMapping.HasColumnPrefix) prefixes.Push(referenceMapping.ColumnPrefix.Replace("{property}", mapping.Member.Name)); }
private static void ProcessSettingNotNullable( IComponentMapping componentMapping ) { foreach ( var propertyMapping in componentMapping.Properties ) { var member = propertyMapping.Member; if ( !member.IsDbNullable () ) { var column = propertyMapping.Columns.Single (); column.NotNull = true; } } foreach ( var manyToOneMapping in componentMapping.References ) { var member = manyToOneMapping.Member; if ( !member.IsDbNullable () ) { foreach ( var column in manyToOneMapping.Columns ) { column.NotNull = true; } } } foreach ( var childComponentMapping in componentMapping.Components ) { ProcessSettingNotNullable ( childComponentMapping ); } }
public void AddComponent(IComponentMapping componentMapping) { if (Components.Any(x => x.Name == componentMapping.Name)) { throw new InvalidOperationException("Tried to add component '" + componentMapping.Name + "' when already added."); } AddMapping(componentMapping, MappingType.IComponent); }
private void StorePrefix(IComponentMapping mapping) { var prefix = mapping.HasColumnPrefix ? mapping.ColumnPrefix.Replace("{property}", mapping.Member.Name) : String.Empty; prefixes.Push(prefix); }
public void AddComponent(IComponentMapping componentMapping) { if (components.Exists(x => x.Name == componentMapping.Name)) { throw new InvalidOperationException("Tried to add component '" + componentMapping.Name + "' when already added."); } components.Add(componentMapping); }
/// <summary> /// Initializes a new instance of the <see cref="TimeDimensionMultiFrequency" /> class. /// </summary> /// <param name="timeDimensionMappings">The time dimension mappings.</param> /// <param name="frequencyComponentMapping">The frequency component mapping.</param> /// <exception cref="System.ArgumentNullException"><paramref name="timeDimensionMappings"/> is null</exception> /// <exception cref="ArgumentNullException"><paramref name="timeDimensionMappings" /> is null</exception> public TimeDimensionMultiFrequency(IDictionary<string, ITimeDimensionMapping> timeDimensionMappings, IComponentMapping frequencyComponentMapping) { if (timeDimensionMappings == null) { throw new ArgumentNullException("timeDimensionMappings"); } this._timeDimensionMappings = timeDimensionMappings; this._frequencyComponentMapping = frequencyComponentMapping; }
/// <summary> /// Initializes a new instance of the <see cref="TimeDimensionMultiFrequency" /> class. /// </summary> /// <param name="timeDimensionMappings">The time dimension mappings.</param> /// <param name="frequencyComponentMapping">The frequency component mapping.</param> /// <exception cref="System.ArgumentNullException"><paramref name="timeDimensionMappings"/> is null</exception> /// <exception cref="ArgumentNullException"><paramref name="timeDimensionMappings" /> is null</exception> public TimeDimensionMultiFrequency(IDictionary <string, ITimeDimensionMapping> timeDimensionMappings, IComponentMapping frequencyComponentMapping) { if (timeDimensionMappings == null) { throw new ArgumentNullException("timeDimensionMappings"); } this._timeDimensionMappings = timeDimensionMappings; this._frequencyComponentMapping = frequencyComponentMapping; }
public override void Visit(IComponentMapping mapping) { if (!(mapping is ReferenceComponentMapping)) { base.Visit(mapping); return; } StorePrefix(mapping); base.Visit(mapping); ResetPrefix(); }
private static void CreateForeignKeys( IComponentMapping componentMapping, Type entityType ) { foreach ( var manyToOneMapping in componentMapping.References ) { var foreignKeyName = manyToOneMapping.GetForeignKeyName ( componentMapping, entityType ); manyToOneMapping.ForeignKey ( foreignKeyName ); } foreach ( var childComponentMapping in componentMapping.Components ) { CreateForeignKeys ( childComponentMapping, entityType ); } }
private static void CreateForeignKeys(IComponentMapping componentMapping, Type entityType) { foreach (var manyToOneMapping in componentMapping.References) { var foreignKeyName = manyToOneMapping.GetForeignKeyName(componentMapping, entityType); manyToOneMapping.ForeignKey(foreignKeyName); } foreach (var childComponentMapping in componentMapping.Components) { CreateForeignKeys(childComponentMapping, entityType); } }
private static void CreateForeignKeyIndexes(IComponentMapping componentMapping, Type entityType) { foreach (var manyToOneMapping in componentMapping.References) { var foreignKeyName = manyToOneMapping.GetForeignKeyName(componentMapping, entityType); const string ForeignKeyIndexNameSuffix = "_IDX"; var indexName = string.Format("{0}{1}", foreignKeyName, ForeignKeyIndexNameSuffix); manyToOneMapping.Index(indexName); } foreach (var childComponentMapping in componentMapping.Components) { CreateForeignKeyIndexes(childComponentMapping, entityType); } }
public virtual void VisitComponent(IComponentMapping componentMapping) { foreach (var reference in componentMapping.References) { VisitReference(reference); } foreach (var collection in componentMapping.Collections) { VisitCollection(collection); } foreach (var component in componentMapping.Components) { VisitComponent(component); } }
protected XmlDocument WriteComponent(string element, IComponentMapping mapping) { var doc = new XmlDocument(); var componentElement = doc.AddElement(element); if (mapping.HasValue("Name")) componentElement.WithAtt("name", mapping.Name); if (mapping.HasValue("Insert")) componentElement.WithAtt("insert", mapping.Insert); if (mapping.HasValue("Update")) componentElement.WithAtt("update", mapping.Update); if (mapping.HasValue("Access")) componentElement.WithAtt("access", mapping.Access); if (mapping.HasValue("OptimisticLock")) componentElement.WithAtt("optimistic-lock", mapping.OptimisticLock); return doc; }
public void Apply(IComponentMapping componentMap, Lazy <Dictionary <Type, ClassMapping> > lazyTypeMap) { foreach (var reference in componentMap.References.Where(o => CanManipulateIdentifier(o.Member.PropertyType))) { var refColumn = Apply(reference, lazyTypeMap); var synteticColumn = componentMap.Properties.SelectMany(o => o.Columns).FirstOrDefault(o => o.Name == refColumn.Name); if (synteticColumn == null) { continue; } synteticColumn.Set(o => o.Length, Layer.UserSupplied, refColumn.Length); synteticColumn.Set(o => o.NotNull, Layer.UserSupplied, refColumn.NotNull); } foreach (var collection in componentMap.Collections.Where(o => CanManipulateIdentifier(o.ContainingEntityType))) { Apply(collection, lazyTypeMap); } foreach (var component in componentMap.Components) { Apply(component, lazyTypeMap); } }
/// <summary> /// Adds series OBS mapping. /// </summary> /// <param name="componentMapping"> /// The component mapping. /// </param> private void AddSeriesObsMapping(IComponentMapping componentMapping) { this._seriesObsComponents.Add(componentMapping); }
/// <summary> /// Builds the component to Mapping dictionary. Before building it the methods make sure that the dictionary is empty /// </summary> private void BuildMappings() { // do some safety work bool measureDimensionMapped = false; IComponentMapping frequencyMapping = null; // fill the dictionaries and the fields foreach (MappingEntity mapping in this._mappingSet.Mappings) { if (this.IsTimeDimensionMapping(mapping)) { // find the mapping that contains the timedimension this._timeMapping = mapping; this._componentMapping.Add(mapping.Components[0], mapping); } else { foreach (ComponentEntity component in mapping.Components) { this._componentMapping.Add(component, mapping); IComponentMapping componentMapping = Sri.MappingStoreRetrieval.Engine.Mapping.ComponentMapping.CreateComponentMapping(component, mapping); //// TODO REMOVE this._componentMappingType.Add(component, componentMapping); this._componentIdMap.Add(component.Id, componentMapping); switch (component.ComponentType) { case SdmxComponentType.Dimension: if (component.MeasureDimension) { measureDimensionMapped = true; } if (component.FrequencyDimension) { frequencyMapping = componentMapping; } if (component.Id.Equals(this._dimensionAtObservation)) { this._dimensionAtObservationMapping = componentMapping; } break; case SdmxComponentType.CrossSectionalMeasure: this._xsMeasureMappings.Add(component.CrossSectionalMeasureCode, mapping); break; } } } } this._componentMappingList = new IComponentMapping[this._componentIdMap.Count]; this._componentIdMap.Values.CopyTo(this._componentMappingList, 0); if (this._timeMapping != null) { this._timeTranscoder = TimeDimensionMapping.Create(this._timeMapping, frequencyMapping, this._mappingSet.DataSet.Connection.DBType); } if (!measureDimensionMapped) { foreach (ComponentEntity component in this._mappingSet.Dataflow.Dsd.Dimensions) { if (component.MeasureDimension) { this.MeasureComponent = component; return; } } } }
public override void Visit(IComponentMapping componentMapping) { componentMapping.AcceptVisitor(this); }
public void AddComponent(IComponentMapping componentMapping) { mappedMembers.AddComponent(componentMapping); }
public DynamicComponentInspector(IComponentMapping mapping) : base(mapping) { this.mapping = mapping; }
protected void BindComponent(IComponentMapping componentMapping, Component model, System.Type reflectedClass, string className, string path, bool isNullable, IDictionary<string, MetaAttribute> inheritedMetas) { model.RoleName = path; inheritedMetas = GetMetas(componentMapping as IDecoratable, inheritedMetas); model.MetaAttributes = inheritedMetas; var componentClassName = componentMapping.Class; if (!string.IsNullOrEmpty(componentClassName)) { model.ComponentClass = ClassForNameChecked(componentClassName, mappings, "component class not found: {0}"); model.ComponentClassName = FullQualifiedClassName(componentClassName, mappings); model.IsEmbedded = false; } else if (componentMapping is HbmDynamicComponent) { model.IsEmbedded = false; model.IsDynamic = true; } else if (reflectedClass != null) { model.ComponentClass = reflectedClass; model.IsEmbedded = false; } else { // an "embedded" component (ids only) model.IsEmbedded = true; if (model.Owner.HasPocoRepresentation) { model.ComponentClass = model.Owner.MappedClass; } else { model.IsDynamic = true; } } string nodeName = !string.IsNullOrEmpty(componentMapping.EmbeddedNode) ? componentMapping.EmbeddedNode : !string.IsNullOrEmpty(componentMapping.Name) ? componentMapping.Name : model.Owner.NodeName; model.NodeName = nodeName; // Parent if (componentMapping.Parent != null && !string.IsNullOrEmpty(componentMapping.Parent.name)) { model.ParentProperty = new Property { Name = componentMapping.Parent.name, PropertyAccessorName = componentMapping.Parent.access ?? mappings.DefaultAccess }; } new PropertiesBinder(Mappings, model, className, path, isNullable, Mappings.Dialect).Bind( componentMapping.Properties, model.Table, inheritedMetas, p => { }, model.AddProperty); }
public virtual void SetDatasourceFields(Item oldDatasource, Item newDatasource, IComponentMapping cm) { newDatasource.Editing.BeginEdit(); foreach (var fieldMap in cm.FieldDefinitions) { fieldMap.FillField(this, ref newDatasource, oldDatasource); } newDatasource.Editing.EndEdit(false, false); newDatasource.Database.Caches.ItemCache.RemoveItem(newDatasource.ID); }
public ComponentInspector(IComponentMapping mapping) : base(mapping) { this.mapping = mapping; mappedProperties.Map(x => x.LazyLoad, x => x.Lazy); }
public void AddComponent(IComponentMapping componentMapping) { mergedComponent.AddComponent(componentMapping); }
public override void Visit(IComponentMapping mapping) { StorePrefix(mapping); base.Visit(mapping); ResetPrefix(); }
public void AddOrReplaceComponent(IComponentMapping componentMapping) { components.RemoveAll(x => x.Name == componentMapping.Name); sequencedMappingObject.RemoveAll(x => x is IComponentMapping && ((IComponentMapping) x).Name == componentMapping.Name); components.Add(componentMapping); sequencedMappingObject.Add(componentMapping); }
public virtual void Visit(IComponentMapping componentMapping) { }
public void AddComponent(IComponentMapping componentMapping) { if (components.Exists(x => x.Name == componentMapping.Name)) throw new InvalidOperationException("Tried to add component '" + componentMapping.Name + "' when already added."); components.Add(componentMapping); }
public void AddOrReplaceComponent(IComponentMapping componentMapping) { AddOrReplaceMapping(componentMapping, MappingType.IComponent, x => x.Name == componentMapping.Name); }
private static void CreateForeignKeyIndexes( IComponentMapping componentMapping, Type entityType ) { foreach ( var manyToOneMapping in componentMapping.References ) { var foreignKeyName = manyToOneMapping.GetForeignKeyName ( componentMapping, entityType ); const string ForeignKeyIndexNameSuffix = "_IDX"; var indexName = string.Format ( "{0}{1}", foreignKeyName, ForeignKeyIndexNameSuffix ); manyToOneMapping.Index ( indexName ); } foreach ( var childComponentMapping in componentMapping.Components ) { CreateForeignKeyIndexes ( childComponentMapping, entityType ); } }
public ComponentBaseInspector(IComponentMapping mapping) { this.mapping = mapping; }
public void AddOrReplaceComponent(IComponentMapping mapping) { mappedMembers.AddOrReplaceComponent(mapping); }
/// <summary> /// Gets the name of the foreign key. /// </summary> /// <param name="manyToOneMapping">The many to one mapping.</param> /// <param name="componentMapping">The component mapping.</param> /// <param name="entityType">Type of the entity.</param> /// <returns>A <see cref="System.String"/></returns> public static string GetForeignKeyName(this ManyToOneMapping manyToOneMapping, IComponentMapping componentMapping, Type entityType) { var manyToOnePropertyType = manyToOneMapping.Member.PropertyType; var propertyTypeName = manyToOnePropertyType.Name; //if ( typeof( ILookup ).IsAssignableFrom ( manyToOnePropertyType ) ) //{ // propertyTypeName += "Lkp"; //} var namingStrategy = componentMapping.GetNamingStrategy(); var columnName = namingStrategy.GetColumnName( componentMapping.Member.DeclaringType, componentMapping.Member.PropertyType, componentMapping.Name, manyToOneMapping.Member.DeclaringType, manyToOneMapping.Member.PropertyType, manyToOneMapping.Name, true); var referenceName = string.Format("{0}_{1}", entityType.Name, propertyTypeName); const string ForeignKeyNameSuffix = "_FK"; if (columnName != propertyTypeName.Replace("Lkp", string.Empty)) { referenceName = string.Format("{0}_{1}_{2}", entityType.Name, propertyTypeName, columnName); } var foreignKeyName = string.Format("{0}{1}", referenceName, ForeignKeyNameSuffix); return(foreignKeyName); }
/// <summary> /// Add <paramref name="componentMapping"/> to <see cref="_groups"/> /// </summary> /// <param name="componentMapping"> /// The group level attribute <see cref="IComponentMapping"/> /// </param> private void AddTimeSeriesGroups(IComponentMapping componentMapping) { foreach (var groupEntity in componentMapping.Component.AttAssignmentGroups) { if (!this._groups.ContainsKey(groupEntity)) { var information = new GroupInformation(groupEntity); this._groups.Add(groupEntity, information); information.ComponentMappings.Add(componentMapping); } } }
/// <summary> /// Add <paramref name="componentMapping"/> to <see cref="_dataSetAttributes"/> /// </summary> /// <param name="componentMapping"> /// The dataset level attribute <see cref="IComponentMapping"/> /// </param> private void AddDataSetAttributes(IComponentMapping componentMapping) { if (this._useDataSetSqlQuery) { this._dataSetAttributes.Add(componentMapping); } else { this._seriesObsComponents.Add(componentMapping); } }
/// <summary> /// Creates the appropriate Time Dimension Mapping object <see cref="ITimeDimension"/> based on the mapping from the mapping store /// e.g. it will create a different object if TimeDimension is mapped to one column, different if it is mapped two column and different if the column is Date type /// </summary> /// <param name="mapping"> /// The mapping entity<see cref="MappingEntity"/> of the Time Dimension component /// </param> /// <param name="frequencyComponentMapping"> /// The frequency component mapping. /// </param> /// <param name="databaseType"> /// The dissemination database vendor. Is needed to generate the correct SQL query where conditions /// </param> /// <returns> /// An Time Dimension Transcoding object<see cref="ITimeDimension"/> /// </returns> public static ITimeDimension Create(MappingEntity mapping, IComponentMapping frequencyComponentMapping, string databaseType) { ITimeDimension timeDimensionTranscoding = null; if (mapping.Transcoding == null) { timeDimensionTranscoding = new TimeDimensionSingleFrequency(CreateTimeDimensionMapping(mapping, databaseType)); } else if (mapping.Transcoding.TimeTranscodingCollection.Count == 1) { timeDimensionTranscoding = new TimeDimensionSingleFrequency(CreateTranscodedTimeDimensionMapping(mapping, databaseType, mapping.Transcoding.TimeTranscodingCollection.First())); } else if (mapping.Transcoding.TimeTranscodingCollection.Count > 1) { var timeDimensionMappings = new Dictionary<string, ITimeDimensionMapping>(StringComparer.Ordinal); foreach (var transcodingEntity in mapping.Transcoding.TimeTranscodingCollection) { var timeDimensionSubTranscoding = CreateTranscodedTimeDimensionMapping(mapping, databaseType, transcodingEntity); timeDimensionMappings[transcodingEntity.FrequencyValue] = timeDimensionSubTranscoding; } timeDimensionTranscoding = new TimeDimensionMultiFrequency(timeDimensionMappings, frequencyComponentMapping); } if (timeDimensionTranscoding != null) { timeDimensionTranscoding.Component = mapping.Components[0]; timeDimensionTranscoding.Mapping = mapping; } return timeDimensionTranscoding; }
/// <summary> /// Add <paramref name="componentMapping"/> to <see cref="_groups"/> /// </summary> /// <param name="componentMapping"> /// The group level attribute <see cref="IComponentMapping"/> /// </param> private void AddTimeSeriesGroups(IComponentMapping componentMapping) { foreach (var groupEntity in componentMapping.Component.AttAssignmentGroups) { GroupInformation information; if (!this._groups.TryGetValue(groupEntity, out information)) { information = new GroupInformation(groupEntity); this._groups.Add(groupEntity, information); } information.ComponentMappings.Add(componentMapping); } }
public virtual void ProcessComponent(IComponentMapping componentMapping) { }
private void StorePrefix(IComponentMapping mapping) { if (mapping.HasColumnPrefix) prefixes.Push(mapping.ColumnPrefix.Replace("{property}", mapping.Member.Name)); }
public void AddOrReplaceComponent(IComponentMapping componentMapping) { components.RemoveAll(x => x.Name == componentMapping.Name); components.Add(componentMapping); }