private void RemoveFragment( EntitySet entitySet, EntityTypeMapping entityTypeMapping, MappingFragment fragment) { EdmProperty defaultDiscriminator = fragment.GetDefaultDiscriminator(); if (defaultDiscriminator != null && entityTypeMapping.EntityType.BaseType != null && !entityTypeMapping.EntityType.Abstract) { ColumnMapping columnMapping = this._tableMappings[fragment.Table].ColumnMappings.SingleOrDefault <ColumnMapping>((Func <ColumnMapping, bool>)(cm => cm.Column == defaultDiscriminator)); if (columnMapping != null) { PropertyMappingSpecification mappingSpecification = columnMapping.PropertyMappings.SingleOrDefault <PropertyMappingSpecification>((Func <PropertyMappingSpecification, bool>)(pm => pm.EntityType == entityTypeMapping.EntityType)); if (mappingSpecification != null) { columnMapping.PropertyMappings.Remove(mappingSpecification); } } defaultDiscriminator.Nullable = true; } if (entityTypeMapping.EntityType.Abstract) { foreach (ColumnMapping columnMapping in this._tableMappings[fragment.Table].ColumnMappings.Where <ColumnMapping>((Func <ColumnMapping, bool>)(cm => cm.PropertyMappings.All <PropertyMappingSpecification>((Func <PropertyMappingSpecification, bool>)(pm => pm.EntityType == entityTypeMapping.EntityType))))) { fragment.Table.RemoveMember((EdmMember)columnMapping.Column); } } entityTypeMapping.RemoveFragment(fragment); if (entityTypeMapping.MappingFragments.Any <MappingFragment>()) { return; } this._databaseMapping.GetEntitySetMapping(entitySet).RemoveTypeMapping(entityTypeMapping); }
private bool FindPropertyEntityTypeMapping( TableMapping tableMapping, EntitySet entitySet, EntityType entityType, bool requiresIsTypeOf, out EntityTypeMapping entityTypeMapping, out MappingFragment fragment) { entityTypeMapping = (EntityTypeMapping)null; fragment = (MappingFragment)null; var data = this._databaseMapping.GetEntityTypeMappings(entityType).SelectMany((Func <EntityTypeMapping, IEnumerable <MappingFragment> >)(etm => (IEnumerable <MappingFragment>)etm.MappingFragments), (etm, tmf) => new { etm = etm, tmf = tmf }).Where(_param1 => _param1.tmf.Table == tableMapping.Table).Select(_param0 => new { TypeMapping = _param0.etm, Fragment = _param0.tmf }).SingleOrDefault(); if (data == null) { return(false); } entityTypeMapping = data.TypeMapping; fragment = data.Fragment; if (requiresIsTypeOf || !entityType.Abstract) { return(true); } this.RemoveFragment(entitySet, data.TypeMapping, data.Fragment); return(false); }
internal static List <MappingInfo> ConvertFragmentToMapping( DbContext context, Type type, MappingFragment mappingFragment, EntityType entityType) { var tableEntitySet = mappingFragment.StoreEntitySet; var tableName = (tableEntitySet.MetadataProperties["Table"].Value ?? tableEntitySet.Name).ToString(); var columnsInfo = GetColumnsInfo(context, tableName); var innerList = mappingFragment.PropertyMappings .OfType <ScalarPropertyMapping>() .Select(x => { return(new MappingInfo() { TableName = tableName, Property = type.GetProperty(x.Property.Name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.GetProperty | BindingFlags.Instance), ColumnInfo = columnsInfo.First(c => c.ColumnName == x.Column.Name), IsDbGenerated = x.Column.IsStoreGeneratedComputed || x.Column.IsStoreGeneratedIdentity, IsKey = entityType.KeyProperties.Any(y => y.Name == x.Property.Name) }); }).ToList(); return(innerList); }
internal void Configure( DbDatabaseMapping databaseMapping, MappingFragment fragment, EntityType entityType) { IEnumerable <EdmPropertyPath> edmPropertyPath = EntityMappingConfiguration.PropertyPathToEdmPropertyPath(this.PropertyPath, entityType); if (edmPropertyPath.Count <EdmPropertyPath>() > 1) { throw Error.InvalidNotNullCondition((object)this.PropertyPath.ToString(), (object)entityType.Name); } EdmProperty column = fragment.ColumnMappings.Where <ColumnMappingBuilder>((Func <ColumnMappingBuilder, bool>)(pm => pm.PropertyPath.SequenceEqual <EdmProperty>((IEnumerable <EdmProperty>)edmPropertyPath.Single <EdmPropertyPath>()))).Select <ColumnMappingBuilder, EdmProperty>((Func <ColumnMappingBuilder, EdmProperty>)(pm => pm.ColumnProperty)).SingleOrDefault <EdmProperty>(); if (column == null || !fragment.Table.Properties.Contains(column)) { throw Error.InvalidNotNullCondition((object)this.PropertyPath.ToString(), (object)entityType.Name); } if (ValueConditionConfiguration.AnyBaseTypeToTableWithoutColumnCondition(databaseMapping, entityType, fragment.Table, column)) { column.Nullable = true; } new System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration() { IsNullable = new bool?(false), OverridableConfigurationParts = OverridableConfigurationParts.OverridableInSSpace }.Configure(edmPropertyPath.Single <EdmPropertyPath>().Last <EdmProperty>()); fragment.AddNullabilityCondition(column, false); }
public static void AddNullabilityCondition( this MappingFragment entityTypeMapppingFragment, EdmProperty column, bool isNull) { entityTypeMapppingFragment.AddConditionProperty((ConditionPropertyMapping) new IsNullConditionMapping(column, isNull)); }
public static void AddDiscriminatorCondition( this MappingFragment entityTypeMapppingFragment, EdmProperty discriminatorColumn, object value) { entityTypeMapppingFragment.AddConditionProperty((ConditionPropertyMapping) new ValueConditionMapping(discriminatorColumn, value)); }
public void WriteMappingFragment_should_write_store_entity_set_name() { var fixture = new Fixture(); var entityType = new EntityType("E", "N", DataSpace.CSpace); var entitySet = new EntitySet("ES", "S", null, null, entityType); var entityContainer = new EntityContainer("EC", DataSpace.SSpace); entityContainer.AddEntitySetBase(entitySet); var storageEntitySetMapping = new EntitySetMapping( entitySet, new EntityContainerMapping(entityContainer)); TypeMapping typeMapping = new EntityTypeMapping(storageEntitySetMapping); var mappingFragment = new MappingFragment(entitySet, typeMapping, false); fixture.Writer.WriteMappingFragmentElement(mappingFragment); Assert.Equal( @"<MappingFragment StoreEntitySet=""ES"" />", fixture.ToString()); }
public static void SetDefaultDiscriminator( this MappingFragment entityTypeMappingFragment, EdmProperty discriminator) { DebugCheck.NotNull(entityTypeMappingFragment); entityTypeMappingFragment.Annotations.SetAnnotation(DefaultDiscriminatorAnnotation, discriminator); }
public static void RemoveDefaultDiscriminatorAnnotation( this MappingFragment entityTypeMappingFragment) { DebugCheck.NotNull(entityTypeMappingFragment); entityTypeMappingFragment.Annotations.RemoveAnnotation(DefaultDiscriminatorAnnotation); }
private static EntityType FindBaseTableForExtraPropertyMapping( DbDatabaseMapping databaseMapping, EntityType entityType, ColumnMappingBuilder pm) { var baseType = (EntityType)entityType.BaseType; MappingFragment baseFragment = null; while (baseType != null && baseFragment == null) { var baseMapping = databaseMapping.GetEntityTypeMapping(baseType); if (baseMapping != null) { baseFragment = baseMapping.MappingFragments.SingleOrDefault( f => f.ColumnMappings.Any(bpm => bpm.PropertyPath.SequenceEqual(pm.PropertyPath))); if (baseFragment != null) { return(baseFragment.Table); } } baseType = (EntityType)baseType.BaseType; } return(null); }
public static void RemoveDefaultDiscriminator( this MappingFragment entityTypeMappingFragment, EntitySetMapping entitySetMapping) { DebugCheck.NotNull(entityTypeMappingFragment); var discriminatorColumn = entityTypeMappingFragment.RemoveDefaultDiscriminatorCondition(); if (discriminatorColumn != null) { var table = entityTypeMappingFragment.Table; table.Properties .Where(c => c.Name.Equals(discriminatorColumn.Name, StringComparison.Ordinal)) .ToList() .Each(table.RemoveMember); } if (entitySetMapping != null && entityTypeMappingFragment.IsConditionOnlyFragment() && !entityTypeMappingFragment.ColumnConditions.Any()) { var entityTypeMapping = entitySetMapping.EntityTypeMappings.Single( etm => etm.MappingFragments.Contains(entityTypeMappingFragment)); entityTypeMapping.RemoveFragment(entityTypeMappingFragment); if (entityTypeMapping.MappingFragments.Count == 0) { entitySetMapping.RemoveTypeMapping(entityTypeMapping); } } }
private EntityType FindOrCreateTargetTable( DbDatabaseMapping databaseMapping, MappingFragment fragment, EntityType entityType, EntityType fromTable, out bool isTableSharing) { isTableSharing = false; EntityType entityType1; if (this.TableName == null) { entityType1 = fragment.Table; } else { entityType1 = databaseMapping.Database.FindTableByName(this.TableName) ?? (entityType.BaseType != null ? databaseMapping.Database.AddTable(this.TableName.Name, fromTable) : fragment.Table); isTableSharing = EntityMappingConfiguration.UpdateColumnNamesForTableSharing(databaseMapping, entityType, entityType1, fragment); fragment.TableSet = databaseMapping.Database.GetEntitySet(entityType1); foreach (ColumnMappingBuilder columnMappingBuilder in fragment.ColumnMappings.Where <ColumnMappingBuilder>((Func <ColumnMappingBuilder, bool>)(cm => cm.ColumnProperty.IsPrimaryKeyColumn))) { ColumnMappingBuilder columnMapping = columnMappingBuilder; EdmProperty edmProperty = entityType1.Properties.SingleOrDefault <EdmProperty>((Func <EdmProperty, bool>)(c => string.Equals(c.Name, columnMapping.ColumnProperty.Name, StringComparison.Ordinal))); columnMapping.ColumnProperty = edmProperty ?? columnMapping.ColumnProperty; } entityType1.SetTableName(this.TableName); } return(entityType1); }
public void GetPropertyMapping_should_return_mapping_with_path() { var entityTypeMapping = new EntityTypeMapping(null); var propertyFoo = EdmProperty.CreateComplex("Foo", new ComplexType("CT")); var propertyBar = EdmProperty.CreatePrimitive("Bar", PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)); var entityPropertyMapping = new ColumnMappingBuilder( new EdmProperty("C", TypeUsage.Create(new PrimitiveType() { DataSpace = DataSpace.SSpace })), new[] { propertyFoo, propertyBar, }); var entityTypeMappingFragment = new MappingFragment(new EntitySet(), entityTypeMapping, false); entityTypeMappingFragment.AddColumnMapping(entityPropertyMapping); entityTypeMapping.AddFragment(entityTypeMappingFragment); Assert.Same(entityPropertyMapping, entityTypeMapping.GetPropertyMapping(propertyFoo, propertyBar)); }
private static bool RemapsInheritedProperties( DbDatabaseMapping databaseMapping, EntityTypeMapping entityTypeMapping) { foreach (EdmProperty edmProperty in entityTypeMapping.EntityType.Properties.Except <EdmProperty>((IEnumerable <EdmProperty>)entityTypeMapping.EntityType.DeclaredProperties).Except <EdmProperty>((IEnumerable <EdmProperty>)entityTypeMapping.EntityType.GetKeyProperties())) { EdmProperty property = edmProperty; MappingFragment fragment = MappingInheritedPropertiesSupportConvention.GetFragmentForPropertyMapping(entityTypeMapping, property); if (fragment != null) { for (EntityType baseType = (EntityType)entityTypeMapping.EntityType.BaseType; baseType != null; baseType = (EntityType)baseType.BaseType) { if (databaseMapping.GetEntityTypeMappings(baseType).Select <EntityTypeMapping, MappingFragment>((Func <EntityTypeMapping, MappingFragment>)(baseTypeMapping => MappingInheritedPropertiesSupportConvention.GetFragmentForPropertyMapping(baseTypeMapping, property))).Any <MappingFragment>((Func <MappingFragment, bool>)(baseFragment => { if (baseFragment != null) { return(baseFragment.Table != fragment.Table); } return(false); }))) { return(true); } } } } return(false); }
private static MappingFragment FindConditionTypeMappingFragment( EntitySet tableSet, MappingFragment propertiesTypeMappingFragment, EntityTypeMapping conditionTypeMapping) { var table = tableSet.ElementType; var conditionTypeMappingFragment = conditionTypeMapping.MappingFragments .SingleOrDefault(x => x.Table == table); if (conditionTypeMappingFragment == null) { conditionTypeMappingFragment = EntityMappingOperations .CreateTypeMappingFragment(conditionTypeMapping, propertiesTypeMappingFragment, tableSet); conditionTypeMappingFragment.SetIsConditionOnlyFragment(true); if (propertiesTypeMappingFragment.GetDefaultDiscriminator() != null) { conditionTypeMappingFragment.SetDefaultDiscriminator( propertiesTypeMappingFragment.GetDefaultDiscriminator()); propertiesTypeMappingFragment.RemoveDefaultDiscriminatorAnnotation(); } } return(conditionTypeMappingFragment); }
public void AddEntityTypeMappingFragment( EntitySet entitySet, EntityType entityType, MappingFragment fragment) { Debug.Assert(fragment.Table == Table); _entityTypes.Add(entitySet, entityType); var defaultDiscriminatorColumn = fragment.GetDefaultDiscriminator(); ConditionPropertyMapping defaultDiscriminatorCondition = null; if (defaultDiscriminatorColumn != null) { defaultDiscriminatorCondition = fragment.ColumnConditions.SingleOrDefault(cc => cc.Column == defaultDiscriminatorColumn); } foreach (var pm in fragment.ColumnMappings) { var columnMapping = FindOrCreateColumnMapping(pm.ColumnProperty); columnMapping.AddMapping( entityType, pm.PropertyPath, fragment.ColumnConditions.Where(cc => cc.Column == pm.ColumnProperty), defaultDiscriminatorColumn == pm.ColumnProperty); } // Add any column conditions that aren't mapped to properties foreach ( var cc in fragment.ColumnConditions.Where(cc => !fragment.ColumnMappings.Any(pm => pm.ColumnProperty == cc.Column))) { var columnMapping = FindOrCreateColumnMapping(cc.Column); columnMapping.AddMapping(entityType, null, new[] { cc }, defaultDiscriminatorColumn == cc.Column); } }
internal void Configure( DbDatabaseMapping databaseMapping, MappingFragment fragment, EntityType entityType, DbProviderManifest providerManifest) { EdmProperty edmProperty = fragment.Table.Properties.SingleOrDefault <EdmProperty>((Func <EdmProperty, bool>)(c => string.Equals(c.Name, this.Discriminator, StringComparison.Ordinal))); if (edmProperty != null && ValueConditionConfiguration.GetMappingFragmentsWithColumnAsDefaultDiscriminator(databaseMapping, fragment.Table, edmProperty).Any <MappingFragment>()) { edmProperty.Name = fragment.Table.Properties.Select <EdmProperty, string>((Func <EdmProperty, string>)(p => p.Name)).Uniquify(edmProperty.Name); edmProperty = (EdmProperty)null; } if (edmProperty == null) { edmProperty = new EdmProperty(this.Discriminator, providerManifest.GetStoreType(DatabaseMappingGenerator.DiscriminatorTypeUsage)) { Nullable = false }; TablePrimitiveOperations.AddColumn(fragment.Table, edmProperty); } if (ValueConditionConfiguration.AnyBaseTypeToTableWithoutColumnCondition(databaseMapping, entityType, fragment.Table, edmProperty)) { edmProperty.Nullable = true; } System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration configuration = edmProperty.GetConfiguration() as System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration; if (this.Value != null) { this.ConfigureColumnType(providerManifest, configuration, edmProperty); fragment.AddDiscriminatorCondition(edmProperty, this.Value); } else { if (string.IsNullOrWhiteSpace(edmProperty.TypeName)) { TypeUsage storeType = providerManifest.GetStoreType(DatabaseMappingGenerator.DiscriminatorTypeUsage); edmProperty.PrimitiveType = (PrimitiveType)storeType.EdmType; edmProperty.MaxLength = new int?(128); edmProperty.Nullable = false; } this.GetOrCreateConfiguration <System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration>().IsNullable = new bool?(true); fragment.AddNullabilityCondition(edmProperty, true); } if (this._configuration == null) { return; } string errorMessage; if (configuration != null && (configuration.OverridableConfigurationParts & OverridableConfigurationParts.OverridableInCSpace) != OverridableConfigurationParts.OverridableInCSpace && !configuration.IsCompatible(this._configuration, true, out errorMessage)) { throw Error.ConflictingColumnConfiguration((object)edmProperty, (object)fragment.Table, (object)errorMessage); } if (this._configuration.IsNullable.HasValue) { edmProperty.Nullable = this._configuration.IsNullable.Value; } this._configuration.Configure(edmProperty, fragment.Table, providerManifest, false, false); }
private static MappingFragment GetEntityDescription <TEntity>(ObjectQuery objectContext) { var clrEntityType = typeof(TEntity); MappingFragment tablename = null; lock (TableNameMapping) { if (TableNameMapping.TryGetValue(clrEntityType, out tablename)) { return(tablename); } } var metadata = objectContext.Context.MetadataWorkspace; // Get the part of the model that contains info about the actual CLR types var objectItemCollection = ((ObjectItemCollection)metadata.GetItemCollection(DataSpace.OSpace)); // Get the entity type from the model that maps to the CLR type var entityType = metadata .GetItems <EntityType>(DataSpace.OSpace) .FirstOrDefault(e => objectItemCollection.GetClrType(e) == clrEntityType); if (entityType == null) { return(null); } // Get the entity set that uses this entity type var entitySet = metadata .GetItems <EntityContainer>(DataSpace.CSpace) .Single() .EntitySets .Single(s => s.ElementType.Name == entityType.Name); // Find the mapping between conceptual and storage model for this entity set var mapping = metadata.GetItems <EntityContainerMapping>(DataSpace.CSSpace) .Single() .EntitySetMappings .Single(s => s.EntitySet == entitySet); // Find the storage entity set (table) that the entity is mapped var m = mapping .EntityTypeMappings.Single() .Fragments.Single(); lock (TableNameMapping) { if (TableNameMapping.TryGetValue(clrEntityType, out tablename)) { return(tablename); } tablename = m; TableNameMapping.Add(clrEntityType, tablename); } return(tablename); }
public static string GetTableName(this MappingFragment mappingFragment) { string schema = mappingFragment.StoreEntitySet.Schema; string tableName = (string)(mappingFragment.StoreEntitySet.MetadataProperties["Table"].Value ?? mappingFragment.StoreEntitySet.Name); return(!string.IsNullOrEmpty(schema) ? $"{schema}.{tableName}" : tableName); }
public static EdmProperty GetDefaultDiscriminator( this MappingFragment entityTypeMapppingFragment) { DebugCheck.NotNull(entityTypeMapppingFragment); return ((EdmProperty) entityTypeMapppingFragment.Annotations.GetAnnotation(DefaultDiscriminatorAnnotation)); }
public static bool IsUnmappedPropertiesFragment(this MappingFragment entityTypeMapppingFragment) { object annotation = entityTypeMapppingFragment.Annotations.GetAnnotation("UnmappedPropertiesFragment"); if (annotation != null) { return((bool)annotation); } return(false); }
public static void CopyPropertyMappingToFragment( ColumnMappingBuilder propertyMappingBuilder, MappingFragment fragment, Func <EdmProperty, bool> isCompatible, bool useExisting) { EdmProperty columnProperty = TablePrimitiveOperations.IncludeColumn(fragment.Table, propertyMappingBuilder.ColumnProperty, isCompatible, useExisting); fragment.AddColumnMapping(new ColumnMappingBuilder(columnProperty, propertyMappingBuilder.PropertyPath)); }
public static bool IsConditionOnlyFragment(this MappingFragment entityTypeMapppingFragment) { object annotation = entityTypeMapppingFragment.Annotations.GetAnnotation("ConditionOnlyFragment"); if (annotation != null) { return((bool)annotation); } return(false); }
internal static void ValidateMappingFragment(MappingFragment mappingFragment) { ValidateEFElement(mappingFragment); Debug.Assert( mappingFragment.EntityTypeMapping != null, "The passed in MappingFragment has a null parent or is not a child of an EntityTypeMapping"); Debug.Assert( mappingFragment.EntityTypeMapping.FirstBoundConceptualEntityType != null, "The parent EntityTypeMapping of the passed in MappingFragment is not bound to an EntityTypes"); }
public static void CopyPropertyMappingToFragment( ColumnMappingBuilder propertyMappingBuilder, MappingFragment fragment, Func <EdmProperty, bool> isCompatible, bool useExisting) { // Ensure column is in the fragment's table var column = TablePrimitiveOperations.IncludeColumn(fragment.Table, propertyMappingBuilder.ColumnProperty, isCompatible, useExisting); // Add the property mapping fragment.AddColumnMapping( new ColumnMappingBuilder(column, propertyMappingBuilder.PropertyPath)); }
public static void UpdateConditions( EdmModel database, EntityType fromTable, MappingFragment fragment) { if (fromTable == fragment.Table) { return; } fragment.ColumnConditions.Each <ConditionPropertyMapping>((Action <ConditionPropertyMapping>)(cc => cc.Column = TableOperations.CopyColumnAndAnyConstraints(database, fromTable, fragment.Table, cc.Column, TablePrimitiveOperations.GetNameMatcher(cc.Column.Name), true))); }
private static IEnumerable <EdmMember> FindServerGenMembers( MappingFragment mappingFragment) { foreach (ScalarPropertyMapping scalarPropertyMapping in ViewLoader.FlattenPropertyMappings(mappingFragment.AllProperties).OfType <ScalarPropertyMapping>()) { if (MetadataHelper.GetStoreGeneratedPattern((EdmMember)scalarPropertyMapping.Column) != StoreGeneratedPattern.None) { yield return((EdmMember)scalarPropertyMapping.Property); } } }
private static IEnumerable <EdmMember> FindIsNullConditionColumns( MappingFragment mappingFragment) { foreach (ConditionPropertyMapping conditionPropertyMapping in ViewLoader.FlattenPropertyMappings(mappingFragment.AllProperties).OfType <ConditionPropertyMapping>()) { if (conditionPropertyMapping.Column != null && conditionPropertyMapping.IsNull.HasValue) { yield return((EdmMember)conditionPropertyMapping.Column); } } }
private static string GetPropertyName(MappingFragment mappingFragment, EdmProperty x) { ScalarPropertyMapping scalarPropertyMapping = mappingFragment.PropertyMappings.Select(y => (ScalarPropertyMapping)y) .FirstOrDefault(y => y.Column.Name == x.Name); if (scalarPropertyMapping != null) { return(scalarPropertyMapping.Property.Name); } throw new Exception($"Cannot extract property name {x.Name}."); }
public static void AddNullabilityCondition( this MappingFragment entityTypeMapppingFragment, EdmProperty column, bool isNull) { DebugCheck.NotNull(entityTypeMapppingFragment); DebugCheck.NotNull(column); entityTypeMapppingFragment .AddConditionProperty( new IsNullConditionMapping(column, isNull)); }
// effects: Given an extent's ("extent") table fragment that is // contained inside typeMap, determine the cells that need to be // created and add them to cells // allTypes corresponds to all the different types that the type map // represents -- this parameter has something useful only if extent // is an entity set private void ExtractCellsFromTableFragment( EntitySetBase extent, MappingFragment fragmentMap, Set<EdmType> allTypes, List<Cell> cells) { // create C-query components var cRootExtent = new MemberPath(extent); var cQueryWhereClause = BoolExpression.True; var cSlots = new List<ProjectedSlot>(); if (allTypes.Count > 0) { // Create a type condition for the extent, i.e., "extent in allTypes" cQueryWhereClause = BoolExpression.CreateLiteral(new TypeRestriction(cRootExtent, allTypes), null); } // create S-query components var sRootExtent = new MemberPath(fragmentMap.TableSet); var sQueryWhereClause = BoolExpression.True; var sSlots = new List<ProjectedSlot>(); // Association or entity set // Add the properties and the key properties to a list and // then process them in ExtractProperties ExtractProperties( fragmentMap.AllProperties, cRootExtent, cSlots, ref cQueryWhereClause, sRootExtent, sSlots, ref sQueryWhereClause); // limitation of MSL API: cannot assign constant values to table columns var cQuery = new CellQuery(cSlots, cQueryWhereClause, cRootExtent, CellQuery.SelectDistinct.No /*no distinct flag*/); var sQuery = new CellQuery( sSlots, sQueryWhereClause, sRootExtent, fragmentMap.IsSQueryDistinct ? CellQuery.SelectDistinct.Yes : CellQuery.SelectDistinct.No); var fragmentInfo = fragmentMap; Debug.Assert((fragmentInfo != null), "CSMappingFragment should support Line Info"); var label = new CellLabel(fragmentInfo); var cell = Cell.CreateCS(cQuery, sQuery, label, m_currentCellNumber); m_currentCellNumber++; cells.Add(cell); }
internal CellLabel(MappingFragment fragmentInfo) : this(fragmentInfo.StartLineNumber, fragmentInfo.StartLinePosition, fragmentInfo.SourceLocation) { }