MembershipUser 业务对象
我有一个单独的项目,其中包含我的所有业务对象。业务对象之一 User
保存登录信息,我想将其转换为 MembershipUser
对象(请参阅 此处)。但是,MembershipUser
对象需要 System.Web
。我不想将该引用添加到我的 BO 项目中。如何将我的业务对象用作 MembershipUser
而不依赖于我的 BO 项目?
I have a separate project that contains all of my business objects. One of the business objects, User
, holds login information and I want to convert it to be a MembershipUser
object (see here). However, MembershipUser
object requires System.Web
. I don't want to add that reference to my BO project. How do I use my business object as a MembershipUser
without the dependency living in my BO project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你真的不能,至少不能直接这样做。我能想到的唯一方法是在您的 Web 项目中编写一个包装类,该类继承自 MembershipUser 并将您的 BO 之一作为构造函数参数,然后将其所有功能委托给 BO。这并不漂亮,但这几乎是我知道解决你的问题的唯一方法。
You really can't, at least not directly. The only way I can think of is to write a wrapper class in your web project which inherits from MembershipUser and takes in one of your BOs as a constructor param, then delegates all its functionality to the BO. It's not pretty, but it's pretty much the only way I'm aware of to solve your problem.