开发者

One to one relationship in Sql Server and LINQ

开发者 https://www.devze.com 2023-01-06 03:23 出处:网络
I have a Users table and a profile table.The reason they are separate is because infor开发者_如何学Pythonmation about the user can be put in before they are registered for the site.The problem I\'m ru

I have a Users table and a profile table. The reason they are separate is because infor开发者_如何学Pythonmation about the user can be put in before they are registered for the site. The problem I'm running into is that when I set the relationship in Sql Server it wants to create a one to many relationship. I don't see any way to change this.


I assume you're creating it using the ASP.NET Membership? If so, simply add a uniqueidentifier column inside your profiles table, set as primary key and you're good to go. SQL won't allow you to add more than 1 record for that ID.

This article provides exactly what you need http://www.asp.net/security/tutorials/storing-additional-user-information-cs

0

精彩评论

暂无评论...
验证码 换一张
取 消