我可以使用实体框架与ASP.NET会员? [英] Can I use Entity Framework with ASP.NET Membership?

查看:182
本文介绍了我可以使用实体框架与ASP.NET会员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建(实际上,重新创建)一个应用程序,已经存在的用户和其他数据,在MS-Access数据库。这些数据将被移动到SQL Server,和该部分涉及迁移用户。我想用EF做ORM,我pretty的肯定,我知道这个数据模型将在SQL Server中的内容。我是新来的EF而不是ASP.NET,我想利用ASP​​.NET成员资格功能。我正在考虑几种方法可以做到这一点,并希望一些建议。我所做的只是一个小小的研究这个想法迄今为止,也许它已在别处回答。所以,在这里不用的相关问题集群。

I'm creating (really, re-creating) an app that has existing user and other data in MS-Access databases. The data will be moved to SQL Server, and part of that involves migrating users. I want to use EF to do ORM, and I am pretty sure I know what the data model will be in SQL Server. I am new to EF but not to ASP.NET, and I'd like to take advantage of the Membership features in ASP.NET. I am thinking about several ways to do this and would like some advice. I've done only a little research about this idea thus far, maybe it's been answered elsewhere. So, here goes a cluster of related questions.

  1. 可以通过一些类或命名空间,我不知道EF直接使用ASP.NET成员资格?

  1. Can EF work with directly with ASP.NET Membership through some class or namespace that I'm not aware of?

如果我转换用户的会员制,来调整其用户ID与我应该创建另一套表的用户数据之上的aspnet_ *表一拉DotNetNuke的?

If I transition users to the Membership system, to align their userids with data in other tables should I create another set of tables for user data atop the aspnet_* tables a la DotNetNuke?

我想避免的情况下我用的是内置的成员函数只有用户验证和切换到EF背景下,当我正与用户标记的数据。似乎笨拙撤销用户信息通过进入一个会员的用户,每行绑定到一个GridView列,但也许这就是我们所需要的?我需要吮吸它,并复制成员类EF进行数据检索的目的?

I want to avoid a situation where I use the built-in Membership functions for only user authentication and switch over to EF context when I'm working with user-tagged data. Seems clumsy to withdraw user info to bind to a column in a GridView by going into a Membership user for every row, but maybe that's what's needed? Do I need to suck it up and replicate the Membership classes in EF for data retrieval purposes?

我想也许实施某种EF供应商会员资格的,对的想法,也许那时的提供者可以坐在整体EF数据模型内。这是呓语? (我以前从来没有写过我自己的供应商)

I was thinking of maybe implementing some kind of EF provider for Membership, on the idea that maybe then the provider could sit inside the overall EF data model. Is this crazy talk? (I've never written my own provider before)

请随时告诉我,我不会让任何意义。

Feel free to tell me I am not making any sense.

推荐答案

为什么不这样做的其他方式?你可以实现自己的会员提供的asp.net,用你想/需要的模式。

Why not do it the other way around? You can implement your own Membership provider for asp.net, that uses the model you want/need.

如果您需要的功能不完全匹配的内置asp.net成员实现,你可以滚你自己的供应商。如果要使用只是一对夫妇的功能,你将必须实现只是一对夫妇的方法(不必填写实现所有方法)。如果你需要更多的功能比它支持使用成员资格提供可能会在你的方式。

If the features you need aren't a complete match with the built-in asp.net membership implementation, you can just roll your own provider. If you will use just a couple features, you will have to implement just a couple methods (you don't have to fill implementation for all the methods). If you need more features than it supports, using the membership provider might get in your way.

这篇关于我可以使用实体框架与ASP.NET会员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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