private void WriteCompositeType(CompositeType type) { // Writing type declaration WriteLine(type.GetDeclaration()); WriteLine("{"); IndentLevel++; if (type is ClassType) { foreach (TypeBase nestedType in ((ClassType)type).NestedChilds) { WriteType(nestedType); AddBlankLine(); } } if (type.SupportsFields) { foreach (Field field in type.Fields) { WriteField(field); } } bool needBlankLine = (type.FieldCount > 0 && type.OperationCount > 0); foreach (Operation operation in type.Operations) { if (needBlankLine) { AddBlankLine(); } needBlankLine = true; WriteOperation(operation); } if (Settings.Default.GenerateNHibernateMapping && Type is ClassType) { WriteCompositeId(); } // Writing closing bracket of the type block IndentLevel--; WriteLine("}"); }
private void WriteCompositeType(CompositeType type) { // Writing type declaration WriteLine(type.GetDeclaration()); WriteLine("{"); IndentLevel++; if (type is ClassType) { foreach (var nestedType in ((ClassType)type).NestedChilds) { WriteType(nestedType); AddBlankLine(); } } if (type.SupportsFields) { foreach (var field in type.Fields) { WriteField(field); } } var needBlankLine = type.FieldCount > 0 && type.OperationCount > 0; foreach (var operation in type.Operations) { if (needBlankLine) { AddBlankLine(); } needBlankLine = true; WriteOperation(operation); } // Writing closing bracket of the type block IndentLevel--; WriteLine("}"); }
private void WriteCompositeType(CompositeType type) { // Writing type declaration WriteLine(type.GetDeclaration() + " {"); AddBlankLine(); IndentLevel++; if (type is ClassType) { foreach (TypeBase nestedType in ((ClassType)type).NestedChilds) { WriteType(nestedType); AddBlankLine(); } } if (type.FieldCount > 0) { foreach (Field field in type.Fields) { WriteField(field); } AddBlankLine(); } if (type.OperationCount > 0) { foreach (Method method in type.Operations) { WriteMethod(method); AddBlankLine(); } } // Writing closing bracket of the type block IndentLevel--; WriteLine("}"); }
private void WriteCompositeType(CompositeType type) { if (type is ClassType) { WriteLine( string.Format( "[Class(Table = \"`{0}`\", Lazy = {1})]", PrefixedText( useLowercaseUnderscored ? LowercaseAndUnderscoredWord(type.Name) : string.IsNullOrEmpty(type.NHMTableName) ? type.Name : type.NHMTableName ), useLazyLoading.ToString().ToLower() )); } // Writing type declaration WriteLine(type.GetDeclaration()); WriteLine("{"); IndentLevel++; if (type is ClassType) { foreach (TypeBase nestedType in ((ClassType)type).NestedChilds) { WriteType(nestedType); AddBlankLine(); } } if (type.SupportsFields) { foreach (Field field in type.Fields) { WriteField(field); } } bool needBlankLine = (type.FieldCount > 0 && type.OperationCount > 0); if (needBlankLine) { AddBlankLine(); } List <Operation> ids = new List <Operation>(); if (Type is ClassType) { ids = type.Operations.Where(o => o is Property && o.IsIdentity).ToList <Operation>(); WriteNHibernateAttributesIds(ids); } foreach (var operation in type.Operations.Where(o => !o.IsIdentity).ToList <Operation>()) { WriteOperation(operation); AddBlankLine(); } if (ids.Count > 1) { WriteEquals(ids); WriteGetHashCode(ids); } // Writing closing bracket of the type block IndentLevel--; WriteLine("}"); }
private void WriteCompositeType(CompositeType type) { if (type is ClassType) { WriteLine(string.Format( "[Class(Table = \"`{0}`\", Lazy = {1})]", PrefixedText( useLowercaseUnderscored ? LowercaseAndUnderscoredWord(type.Name) : type.Name ), useLazyLoading ? "true" : "false" )); } // Writing type declaration WriteLine(type.GetDeclaration()); WriteLine("{"); IndentLevel++; if (type is ClassType) { foreach (TypeBase nestedType in ((ClassType)type).NestedChilds) { WriteType(nestedType); AddBlankLine(); } } if (type.SupportsFields) { foreach (Field field in type.Fields) { WriteField(field); } } bool needBlankLine = (type.FieldCount > 0 && type.OperationCount > 0); int index = 0; List <Property> compositeId = new List <Property>(); if (Type is ClassType) { ClassType _class = (ClassType)Type; if (entities.Contains(_class.Operations.ToList()[0].Type)) { for (; index <= (_class.Operations.Count() - 1); index++) { if (_class.Operations.ToList()[index] is Property) { Property property = (Property)_class.Operations.ToList()[index]; if (entities.Contains(property.Type)) { compositeId.Add(property); } else { break; } } } } if (compositeId.Count > 1) { if (needBlankLine) { AddBlankLine(); } WriteNHibernateAttributesCompositeId(compositeId); } else { index = 0; } } for (; index <= (type.Operations.Count() - 1); index++) { if (needBlankLine) { AddBlankLine(); } needBlankLine = true; WriteOperation(type.Operations.ToList()[index]); } if (compositeId.Count > 1) { WriteEquals(compositeId); WriteGetHashCode(compositeId); } // Writing closing bracket of the type block IndentLevel--; WriteLine("}"); }