private void BuildForeignKeyOperation( XDocument edmx, XElement association, ForeignKeyOperation foreignKeyOperation) { DebugCheck.NotNull(edmx); DebugCheck.NotNull(association); DebugCheck.NotNull(foreignKeyOperation); var principal = association.Descendants(EdmXNames.Ssdl.PrincipalNames).Single(); var dependent = association.Descendants(EdmXNames.Ssdl.DependentNames).Single(); var principalRole = association.Descendants(EdmXNames.Ssdl.EndNames).Single( r => r.RoleAttribute() == principal.RoleAttribute()); var dependentRole = association.Descendants(EdmXNames.Ssdl.EndNames).Single( r => r.RoleAttribute() == dependent.RoleAttribute()); var principalTable = GetQualifiedTableNameFromType(edmx, principalRole.TypeAttribute()); var dependentTable = GetQualifiedTableNameFromType(edmx, dependentRole.TypeAttribute()); foreignKeyOperation.PrincipalTable = principalTable; foreignKeyOperation.DependentTable = dependentTable; foreignKeyOperation.IsSystem = association.IsSystem(); dependent.Descendants(EdmXNames.Ssdl.PropertyRefNames) .Each(pr => foreignKeyOperation.DependentColumns.Add(pr.NameAttribute())); }
private void AddTableForeignKeyIndex(ForeignKeyOperation operation) { if (operation == null) { return; } AddTableIndex(operation.DependentTable, operation.DependentColumns); var addOperation = operation as AddForeignKeyOperation; if (addOperation != null) { AddTableIndex(addOperation.PrincipalTable, addOperation.PrincipalColumns); } }
private void Generate(ForeignKeyOperation foreignKeyOperation) { return; // TODO // throw new NotImplementedException(); }