private Vertex[] ConvertMappingConditionsToVertices( ConversionContext <DomainConstraint <string, ValueCondition> > converter, DomainVariable <string, ValueCondition>[] variables) { Vertex[] vertexArray = new Vertex[this.NormalizedEntityTypeMappings.Count]; for (int index1 = 0; index1 < vertexArray.Length; ++index1) { FunctionImportNormalizedEntityTypeMapping entityTypeMapping = this.NormalizedEntityTypeMappings[index1]; Vertex left = Vertex.One; for (int index2 = 0; index2 < this.DiscriminatorColumns.Count; ++index2) { FunctionImportEntityTypeMappingCondition columnCondition = entityTypeMapping.ColumnConditions[index2]; if (columnCondition != null) { ValueCondition conditionValue = columnCondition.ConditionValue; if (conditionValue.IsNotNullCondition) { TermExpr <DomainConstraint <string, ValueCondition> > term = new TermExpr <DomainConstraint <string, ValueCondition> >(new DomainConstraint <string, ValueCondition>(variables[index2], ValueCondition.IsNull)); Vertex vertex = converter.TranslateTermToVertex(term); left = converter.Solver.And(left, converter.Solver.Not(vertex)); } else { TermExpr <DomainConstraint <string, ValueCondition> > term = new TermExpr <DomainConstraint <string, ValueCondition> >(new DomainConstraint <string, ValueCondition>(variables[index2], conditionValue)); left = converter.Solver.And(left, converter.TranslateTermToVertex(term)); } } } vertexArray[index1] = left; } return(vertexArray); }
private Vertex[] ConvertMappingConditionsToVertices( ConversionContext <DomainConstraint <string, ValueCondition> > converter, DomainVariable <string, ValueCondition>[] variables) { var conditions = new Vertex[NormalizedEntityTypeMappings.Count]; for (var i = 0; i < conditions.Length; i++) { var typeMapping = NormalizedEntityTypeMappings[i]; // create conjunction representing the condition var condition = Vertex.One; for (var j = 0; j < DiscriminatorColumns.Count; j++) { var columnCondition = typeMapping.ColumnConditions[j]; if (null != columnCondition) { var conditionValue = columnCondition.ConditionValue; if (conditionValue.IsNotNullCondition) { // the 'not null' condition is not actually part of the domain (since it // covers other elements), so create a Not(value in {null}) condition var isNull = new TermExpr <DomainConstraint <string, ValueCondition> >( new DomainConstraint <string, ValueCondition>(variables[j], ValueCondition.IsNull)); var isNullVertex = converter.TranslateTermToVertex(isNull); condition = converter.Solver.And(condition, converter.Solver.Not(isNullVertex)); } else { var hasValue = new TermExpr <DomainConstraint <string, ValueCondition> >( new DomainConstraint <string, ValueCondition>(variables[j], conditionValue)); condition = converter.Solver.And(condition, converter.TranslateTermToVertex(hasValue)); } } } conditions[i] = condition; } return(conditions); }
private Vertex[] ConvertMappingConditionsToVertices( ConversionContext<DomainConstraint<string, ValueCondition>> converter, DomainVariable<string, ValueCondition>[] variables) { var conditions = new Vertex[NormalizedEntityTypeMappings.Count]; for (var i = 0; i < conditions.Length; i++) { var typeMapping = NormalizedEntityTypeMappings[i]; // create conjunction representing the condition var condition = Vertex.One; for (var j = 0; j < DiscriminatorColumns.Count; j++) { var columnCondition = typeMapping.ColumnConditions[j]; if (null != columnCondition) { var conditionValue = columnCondition.ConditionValue; if (conditionValue.IsNotNullCondition) { // the 'not null' condition is not actually part of the domain (since it // covers other elements), so create a Not(value in {null}) condition var isNull = new TermExpr<DomainConstraint<string, ValueCondition>>( new DomainConstraint<string, ValueCondition>(variables[j], ValueCondition.IsNull)); var isNullVertex = converter.TranslateTermToVertex(isNull); condition = converter.Solver.And(condition, converter.Solver.Not(isNullVertex)); } else { var hasValue = new TermExpr<DomainConstraint<string, ValueCondition>>( new DomainConstraint<string, ValueCondition>(variables[j], conditionValue)); condition = converter.Solver.And(condition, converter.TranslateTermToVertex(hasValue)); } } } conditions[i] = condition; } return conditions; }