ErikEJ / EntityFramework6PowerTools

This is the codebase for Entity Framework 6 Power Tools Community Edition, and modern EF 6 providers for SQL Server and SQL Server Compact
Other
183 stars 27 forks source link

Error generating Entity Data Models (Read-Only, XML, DDL SQL) #67

Closed krptodr closed 4 years ago

krptodr commented 4 years ago

I right click my context and and select either of the View Entity Data Model options and get an error similar to:

Could not load type \'*.Business.Entities.Authentication.ApplicationUser\' from assembly \'*.Business.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

ApplicationUser inherits from Microsoft.AspNet.Identity.EntityFramework.IdentityUser

I've modified relationships on the other Identity tables, so that my ApplicationUser class could take advantage of the correct foreign key association(userId instead of ApplicationUser_Id).

FluentAPI for ApplicationUser:

Public Class Mappings
      Inherits Data.Entity.ModelConfiguration.EntityTypeConfiguration(Of ApplicationUser)

   Public Sub New()
      Me.ToTable("TableUser")
      Me.Property(Function(p) p.Id).HasColumnName("USERID")

      Me.Property(Function(p) p.Email).HasMaxLength(256).IsUnicode(False)
      Me.Property(Function(p) p.UserName).HasMaxLength(256).IsUnicode(False)
      Me.Property(Function(p) p.PasswordHash).HasMaxLength(256).IsUnicode(False)
      Me.Property(Function(p) p.SecurityStamp).HasMaxLength(256).IsUnicode(False)
      Me.Property(Function(p) p.PhoneNumber).HasMaxLength(256).IsUnicode(False)

      'Me.HasMany(Function(s) s.Logins).WithRequired().HasForeignKey(Function(f) f.UserId)
      'Me.HasMany(Function(s) s.Roles).WithRequired().HasForeignKey(Function(f) f.UserId)
      'Me.HasMany(Function(s) s.Claims).WithRequired().HasForeignKey(Function(f) f.UserId)
   End Sub
End Class
ErikEJ commented 4 years ago

And you use EF6?

krptodr commented 4 years ago

@ErikEJ I apologize for the lack of detail. Yes EF 6.2

ErikEJ commented 4 years ago

Can you share a repro project?

ErikEJ commented 4 years ago

Closing this a no repro provided, feel free to re-open if you can provide one.