Entity Framework Duplicate type name within an assembly (6.1.0)

前端 未结 10 1749
臣服心动
臣服心动 2020-12-29 01:41

I am not sure what is going on but I keep getting the following exception when doing a query. \"Duplicate type name within an assembly.\" I have not been able to find a solu

10条回答
  •  鱼传尺愫
    2020-12-29 02:07

    Must be correcting "select Users;" segment of code :

    var BaseQuery = from Users in db.Users
            join UserInstalls in db.UserTenantInstalls on Users.ID equals UserInstalls.UserID
            join Installs in db.TenantInstalls on UserInstalls.TenantInstallID equals Installs.ID
            where
                Users.Username == Username
                && Users.Password == Password
                && Installs.Name == Install
            select Users;
    

    Correction code :

    select new { ID=Users.ID, F1= Users.forExampleField1,
                 F2= UserInstalls.forExampleFild1, 
                 F3= Installs.forExampleFild1 , 
                 F4= Installs.forExampleFild2 };
    

    The reason:

    Foreign key fields in the class are present and "Linq" are not able to remove them which there was the following error:

    Duplicate type name within an assembly

    (Of course this problem Fault "entity framework" !)

    I am a full explanation on this matter, But unfortunately my English is not very good and it is really hard for me to explain specialization, because I understand that many people do not understand what I mean. I apologize for this.

提交回复
热议问题