简体   繁体   English

OWIN仅用于ASP.net身份吗? 我们不能使用owin上下文查询应用程序数据库吗?

[英]Is OWIN only for ASP.net Identity? Can't we use owin context to query our application db?

I am very new to EF, ASP.Net MVC, ASP.net Identity etc. 我对EF,ASP.Net MVC,ASP.net Identity等非常陌生。

I am creating a simple e-commerce website for learning above mentioned stuff. 我正在创建一个简单的电子商务网站来学习上述内容。 My query is, how can I query the application database? 我的查询是,如何查询应用程序数据库?

Is OWIN context only used for ASP.net Identity? OWIN上下文仅用于ASP.net身份吗?

Yes, that context should only be used for asp.net identity 是的,该上下文仅应用于asp.net身份

OWIN and asp.net identity are completely separate concepts : OWIN和asp.net身份是完全独立的概念:

ASP.Net Identity : This framework is used for user management/authentication mechanism etc. For more detail please Follow this link ASP.Net Identity:此框架用于用户管理/身份验证机制等。有关更多详细信息,请单击此链接

OWIN : Owin defines an abstraction between .NET web servers and web applications. OWIN: Owin定义了.NET Web服务器和Web应用程序之间的抽象。 By decoupling the web server from the application, OWIN makes it easier to create middleware for .NET web development. 通过将Web服务器与应用程序分离,OWIN使创建用于.NET Web开发的中间件变得更加容易。 Also, OWIN makes it easier to port web applications to other hosts—for example, self-hosting in a Windows service or other process. 同样,OWIN使将Web应用程序移植到其他主机变得更加容易,例如,Windows服务或其他进程中的自托管。 For more information follow this link 欲了解更多信息,请点击此链接

Now what you are trying to do is that you want to use entity framework to query the database in various scenarios. 现在,您想要做的是要使用实体框架在各种情况下查询数据库。 So for that you should create a custom context, define your schema in it and do whatever query you want to do over that. 因此,您应该创建一个自定义上下文,在其中定义您的架构,然后执行您想对此进行的任何查询。

To know more about entity framework you can start from here 要了解有关实体框架的更多信息,可以从这里开始

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM