internal void LoadScalarProperties() { if (null == _scalarProperties) { _scalarProperties = new List <MappingFunctionScalarProperty>(); // load children from model // note: have to go to parent to get this as this is a dummy node if (Function != null && MappingFunctionEntityType != null && MappingFunctionEntityType.EntityType != null) { var entityType = MappingFunctionEntityType.EntityType; // loop through all of the 'parameters' in the function foreach (var parm in Function.Parameters()) { FunctionScalarProperty existingScalarProperty = null; // for each column, see if we are already have a scalar property var antiDeps = parm.GetAntiDependenciesOfType <FunctionScalarProperty>(); foreach (var scalarProperty in antiDeps) { // this FunctionScalarProperty could be right under the function, nested inside an AssociationEnd, // or N levels deep inside a complex type hierarchy var spmf = scalarProperty.GetParentOfType(typeof(ModificationFunction)) as ModificationFunction; // if we find one, validate it if (scalarProperty != null && scalarProperty.Name.Status == BindingStatus.Known && spmf != null && ModificationFunction == spmf) { // make sure we are looking at something mapped by the entity type we are mapping if (entityType != spmf.ModificationFunctionMapping.EntityTypeMapping.FirstBoundConceptualEntityType) { continue; } // we are already mapping this existingScalarProperty = scalarProperty; break; } } // if we didn't find one, then create a dummy row with just the column info if (existingScalarProperty == null) { var msp = new MappingFunctionScalarProperty(_context, null, this); msp.StoreParameter = parm; _scalarProperties.Add(msp); } else { var msp = (MappingFunctionScalarProperty) ModelToMappingModelXRef.GetNewOrExisting(_context, existingScalarProperty, this); _scalarProperties.Add(msp); } } } } }
internal void LoadScalarProperties() { if (null == _scalarProperties) { _scalarProperties = new List<MappingFunctionScalarProperty>(); // load children from model // note: have to go to parent to get this as this is a dummy node if (Function != null && MappingFunctionEntityType != null && MappingFunctionEntityType.EntityType != null) { var entityType = MappingFunctionEntityType.EntityType; // loop through all of the 'parameters' in the function foreach (var parm in Function.Parameters()) { FunctionScalarProperty existingScalarProperty = null; // for each column, see if we are already have a scalar property var antiDeps = parm.GetAntiDependenciesOfType<FunctionScalarProperty>(); foreach (var scalarProperty in antiDeps) { // this FunctionScalarProperty could be right under the function, nested inside an AssociationEnd, // or N levels deep inside a complex type hierarchy var spmf = scalarProperty.GetParentOfType(typeof(ModificationFunction)) as ModificationFunction; // if we find one, validate it if (scalarProperty != null && scalarProperty.Name.Status == BindingStatus.Known && spmf != null && ModificationFunction == spmf) { // make sure we are looking at something mapped by the entity type we are mapping if (entityType != spmf.ModificationFunctionMapping.EntityTypeMapping.FirstBoundConceptualEntityType) { continue; } // we are already mapping this existingScalarProperty = scalarProperty; break; } } // if we didn't find one, then create a dummy row with just the column info if (existingScalarProperty == null) { var msp = new MappingFunctionScalarProperty(_context, null, this); msp.StoreParameter = parm; _scalarProperties.Add(msp); } else { var msp = (MappingFunctionScalarProperty) ModelToMappingModelXRef.GetNewOrExisting(_context, existingScalarProperty, this); _scalarProperties.Add(msp); } } } } }