许多人在自定义数据库AspNetUsers(标识)和其他表之间的多对多关系 [英] Many to many relationship between AspNetUsers (Identity) and other tables in a custom database

查看:292
本文介绍了许多人在自定义数据库AspNetUsers(标识)和其他表之间的多对多关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习ASP.NET,我跟着<一个href=\"http://www.asp.net/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/introduction-and-overview\"相对=nofollow>这个教程。所以,我有一个简单的应用程序,它使用ASP.NET身份会员制,有一个包含产品及车中的项目额外的数据库。

I'm starting to learn ASP.NET and I followed this tutorial. So, I got a simple app which uses the ASP.NET Identity membership system and has an additional database containing products and cart items.

有用于创建用户和产品数据之间的许多一对多的关系,考虑到他们属于(我猜)两个不同的数据库的方法吗?
我也想救谁增加了一个新项目的用户,所以我需要一个多到一的关系或外键。我发现Web窗体一堆的MVC指定教程,但是没有因为我是一个初学者我没弄清楚如何实现我的需要。

Is there a way for creating a many-to-many relationship between the users and the products data, considering they belong to (I guess) two different databases? I also want to save the user who adds a new item, so I would need a many-to-one relationship or a foreign key. I found a bunch of tutorials specified for MVC, but none for Web Forms and since I'm a beginner I didn't manage to figure out how to implement that for my needs.

推荐答案

它存储每一个项目添加到购物车约谁添加它的用户没有资料,所以每车项目被证明谁登录每个用户

您确定吗?

如果用户在签署作为注册用户,大车ID设置为
  他们的用户名。但是,如果用户没有登录,车ID是
  设置为唯一值(GUID)。一个GUID确保只有一个车是
  为每个用户,基于会话创建

If the user is signed in as a registered user, the cart ID is set to their user name. However, if the user is not signed in, the cart ID is set to a unique value (a GUID). A GUID ensures that only one cart is created for each user, based on session.

这篇关于许多人在自定义数据库AspNetUsers(标识)和其他表之间的多对多关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆