亚音速 poco 类的扩展方法?
我正在考虑从流畅的 nhibernate 切换到 subsonic,因为 nhib 似乎有大量的内存占用,我真的不喜欢,但我只是想检查 subsonic (可能是简单的存储库)如何处理:
添加额外的字段到数据库:目前我可以将字典值映射到数据库中的字段,这非常酷,这在亚音速中可能吗? (或类似的东西?)
FWIW:DynamicComponent(x => x.PropertyBag, GetDynamicComponentPart);其中 propertybag 是字典。
多对多关系
- 级联保存/删除
- 将复杂对象映射到 xml 或 varchar(max) 列(显然将其序列化为 xml)
I'm considering switching from fluent nhibernate to subsonic as nhib just seems to have a MASSIVE memory footprint which I'm really not enjoying, but I just want to check how subsonic (the simple repository probably) would cope with:
adding extra fields to a database: at the moment I can map a dictionary value to a field in the database which is VERY cool, is this possible in subsonic? (or anything similar?)
FWIW: DynamicComponent(x => x.PropertyBag, GetDynamicComponentPart); where propertybag is a Dictionary.
many to many relationships
- cascading saves/deletes
- mapping a complex object to an xml or varchar(max) column (seralize it to xml obviously)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加字段相当简单。只需将字段添加到表中,然后从 T4 模板重新生成类。
不过,您不会获得任何超出基本原始类型的映射。当然不是某个领域的字典。
您必须对 T4 模板进行自定义修改才能获得对多对多表的任何类型的支持。 SubSonic 就像对待任何其他桌子一样对待它们。
我已经做了这样的修改,但它们的用处有限。
仅在 RDBMS 端。也就是说,如果您使用级联设置外键关系。 SubSonic 不做这些。
不。你得不到这样的支持。没有可扩展性挂钩来插入您自己的类型转换器。
SubSonic 是与 NHibernate 完全不同的领域。我会把 NHib 称为 ORM,但我不会这样称呼 SubSonic。 SubSonic 的作者 Rob Conery 将其称为查询工具。
它非常简单,这是它的目标和优点(也是缺点)。它有助于以强类型的方式进行查询和修改。与 NHib 甚至实体框架相比,它缺乏大量的功能和可配置性/可扩展性。
我会警告不要从 NHib 迁移到 SS,特别是如果您已经在 NHibernate 中实现了一定数量的功能。并不是说SS是一个不好的工具,而是它有很多限制。
Adding fields is fairly simple. Just add the field to the table, then re-generate the classes from the T4 template.
You won't get any mapping beyond basic primitive types, though. Certainly not a dictionary in a field.
You will have to make custom modifications to the T4 template to get any sort of support for many-to-many tables. SubSonic just treats them like any other table.
I have made such modifications and they are of limited usefulness.
Only on the RDBMS side. That is, if you setup foreign key relationships with cascades. SubSonic doesn't do any of this.
Nope. You get no support like this. There are no extensibility hooks to insert your own type converters.
SubSonic is a completely different field from NHibernate. I would call NHib an ORM, but I would not call SubSonic that. Rob Conery, the author of SubSonic, would call it a query tool.
It is very simplistic, which is its goal and strength (as well as weakness). It assists with querying and modifications in a strongly typed way. It lacks a huge amount of features and configurability/extensibility compared to NHib or even Entity Framework.
I would caution against moving from NHib to SS, especially if you have any amount of functionality implemented in NHibernate already. Not that SS is a bad tool, but it has a lot of restrictions.