we're facing 2 problems with the code generation template in Entity Developer 5.8.782:
There are 2 tables (Address and Addresstype) Addresstype has a navigation property (Addresses) which points to the Address table. We're using configuration classes with fluent mapping.
The template generates the following config:
Address:
Code: Select all
'------------------------------------------------------------------------------
' This is auto-generated code.
'------------------------------------------------------------------------------
' This code was generated by Devart Entity Developer tool using Entity Framework DbContext template.
' Code is generated on: 03.02.2016 13:19:49
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
'------------------------------------------------------------------------------
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Collections.Specialized
Imports System.Runtime.Serialization
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.Data.Entity.ModelConfiguration
Namespace Model.Mapping
Public Partial Class AddressConfiguration
Inherits EntityTypeConfiguration(Of Address)
Public Sub New()
Me _
.HasKey(Function(p) New With { p.IdAddress }) _
.ToTable("address", "sentis_luv")
' Properties:
Me _
.Property(Function(p) p.IdAddress) _
.HasColumnName("idAddress") _
.IsRequired() _
.HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity) _
.HasColumnType("bigint")
Me _
.Property(Function(p) p.IdAddressType) _
.HasColumnName("idAddressType") _
.IsRequired() _
.HasColumnType("bigint")
Me _
.Property(Function(p) p.Title) _
.HasColumnName("title") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.FirstName) _
.HasColumnName("firstName") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.FirstName2) _
.HasColumnName("firstName2") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.LastName) _
.HasColumnName("lastName") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.NameAddition) _
.HasColumnName("nameAddition") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.SaveAs) _
.HasColumnName("saveAs") _
.HasMaxLength(255) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Position) _
.HasColumnName("position") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Company) _
.HasColumnName("company") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.PhoneCompany) _
.HasColumnName("phoneCompany") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.PhoneMobile) _
.HasColumnName("phoneMobile") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.PhonePrivate) _
.HasColumnName("phonePrivate") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Mail1) _
.HasColumnName("mail1") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Mail2) _
.HasColumnName("mail2") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Mail3) _
.HasColumnName("mail3") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Fax1) _
.HasColumnName("fax1") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Fax2) _
.HasColumnName("fax2") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Homepage) _
.HasColumnName("homepage") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Street) _
.HasColumnName("street") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Zip) _
.HasColumnName("zip") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.City) _
.HasColumnName("city") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Country) _
.HasColumnName("country") _
.HasMaxLength(45) _
.HasColumnType("varchar")
Me _
.Property(Function(p) p.Picture) _
.HasColumnName("picture") _
.HasColumnType("mediumblob")
Me _
.Property(Function(p) p.Comment) _
.HasColumnName("comment") _
.HasMaxLength(255) _
.HasColumnType("varchar")
OnCreated()
End Sub
Partial Private Sub OnCreated()
End Sub
End Class
End Namespace
Code: Select all
'------------------------------------------------------------------------------
' This is auto-generated code.
'------------------------------------------------------------------------------
' This code was generated by Devart Entity Developer tool using Entity Framework DbContext template.
' Code is generated on: 03.02.2016 13:19:49
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
'------------------------------------------------------------------------------
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Collections.Specialized
Imports System.Runtime.Serialization
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.Data.Entity.ModelConfiguration
Namespace Model.Mapping
Public Partial Class AddresstypeConfiguration
Inherits EntityTypeConfiguration(Of Addresstype)
Public Sub New()
Me _
.HasKey(Function(p) New With { p.IdaddressType }) _
.ToTable("addresstype", "sentis_luv")
' Properties:
Me _
.Property(Function(p) p.IdaddressType) _
.HasColumnName("idaddressType") _
.IsRequired() _
.HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity) _
.HasColumnType("bigint")
Me _
.Property(Function(p) p.Description) _
.HasColumnName("description") _
.IsRequired() _
.HasMaxLength(45) _
.HasColumnType("varchar")
' Association:
Me _
.HasMany(Function(p) p.Addresses) _
.WithRequired(Function(c) c.Addresstype) _
.HasForeignKey(Function(p) New With {p.IdAddressType}) _
.WillCascadeOnDelete(False)
OnCreated()
End Sub
Partial Private Sub OnCreated()
End Sub
End Class
End Namespace
Exception:
InvalidOperationException
The properties expression 'p => new VB$AnonymousType_1`1(IdaddressType = p.IdAddressType)' is not valid. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new { t.MyProperty1, t.MyProperty2 }' VB.Net: 'Function(t) New With { t.MyProperty1, t.MyProperty2 }'.
The other problem (not sure if it is by design):
When setting the Model setting "Preserve schema name in storage" to "false", no associations between tables (1:n relationships) are created neither in the diagram nor in the configuration classes.
Software:
- DotConnect MySQL 8.4.583
- Entity Developer 5.8.782
- Entity Framework 6
- Visual Studio 2015 Update 1
- MySQL 5.7
Can someone help me plz?
Thanks
Scheurich