且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

1个实体2表与DbContext生成器?

更新时间:2022-10-23 21:24:43

我认为您正在创建两个表的主键之间的关系。将Usuario.UsuarioID定义为外键,将my_aspnet_membership.userId定义为主键并创建关系。

Hi is it possible to create a entity using 2 tables using de ADO.NET DBContext Generator ?

 

i have the my_aspnet_membership and my tabler usuarios,

my_aspnet_membership (userId,email) ; usuarios (usuarioID, Nome)

i linked using 1 to 0..1 relationshionp. my_aspnet_membership.userId -> Usuario.UsuarioID

i want to create usuarios entity with a property "email" mapped to the column of the table my_aspnet_membership.

i tried to map but i get the error

Error    1    Error 3033: Problem in mapping fragments starting at line 667:EntitySets 'Usuarios' and 'my_aspnet_membership' are both mapped to table 'my_aspnet_membership'. Their primary keys may collide.

what can i do to fix this?

 

I think you are creating relationship between primary keys of two table.Define Usuario.UsuarioID as foreign key and my_aspnet_membership.userId as your primary key and create relationship.