Fluent Linq to Entities - 无 edmx 文件
是否有一个“Fluent Linq To Entites”,我可以使用它来设置我的 dataContext,而无需通过图表文件映射任何内容?
我所需要的只是将我的数据库表映射到某些域类,而不需要延迟加载。 我尝试使用 LinqToSql,但这是不行的,因为我的域类都继承自基类。
注意:我们只能使用.NET 3.5
Is there a "Fluent Linq To Entites" that I can use to Setup my dataContext without having to map anything through diagram files?
All I need is to map my db tables to certain domain classes without any need for Lazy-Loading.
I tried using LinqToSql but it was a No-Go since my domain classes all inherit from base classes.
Note: We can only use .NET 3.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您可以摆脱使用实体框架,您可以使用 Fluent NHibernate + AutoMapping。 http://wiki. Fluentnhibernate.org/Auto_mapping
或者你可以使用 Linq 2 SQL 来装饰你的实体属性。
就像:
然后使用 dbcontext 访问它,比如:
沿着这些线,我把它写在了我的脑海里,但你明白了要点。
我会选择 Fluent+AutoMapping。
If you can get away from using Entity Framework, you could use Fluent NHibernate + AutoMapping. http://wiki.fluentnhibernate.org/Auto_mapping
Or you could use Linq 2 SQL by decorating your entity with attributes.
Like:
Then access it using the dbcontext like:
Along those lines, wrote that off top of my head but you get the gist.
I would go Fluent+AutoMapping.
最近有一个 实体框架的 CTP 版本,为“代码优先”或“仅代码”开发风格提供支持。我相信这些库将允许您在没有地图的情况下设置您的上下文。但是,我认为当前发布的实体框架没有任何东西可以满足您的需求。
There has recently been a CTP release of Entity Framework that provides support for a "Code First" or "Code Only" style of development. I believe those libraries will allow you to setup your context without a map. However, I don't think that there is anything currently released for Entity Framework which will do what you're looking for.