问题标签 [subsonic-v3p2]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
213 浏览

linq - linq 帮助 - 新手

这个工作怎么来的

但这并不

0 投票
1 回答
2842 浏览

subsonic - Inserting a new record pattern in SubSonic 3

I'm trying out the new SubSonic 3 preview, but I'm not sure about the patterns I should be using for the basic CRUD operations in my MVC project.

I'm trying to keep as much of my data logic in my models, so I added some static CRUD methods to each model's partial class.

For example, let's say I have a configuration table, which should only have a single record. So, my partial class may look something like this:

Currently, this doesn't work as the config table has an identity column for a primary key, and Add-ing a new record to the table throws the standard "Cannot insert explicit value for identity column" error. SubSonic 3 doesn't seem to generate classes that, upon new-ing them up, play nice with the rules of the database schema (i.e., no default values, no nullable primitives for values that are nullable in the database, etc).

Now, I can alter my table and pattern to get around these issues, but I'm wondering about when I cannot get around this issue--when I have to add a new record to the database and have an identity as my primary key.

I'm also wondering if this pattern is even correct or not. SubSonic gives you a number of different ways you can go about your repository business, so I'm not sure which one I should be using. I'd LIKE to use my models as MUCH as possible (otherwise why not just Linq to Sql?), so I don't want to use SubSonic's query building goodness when trying to CRUD my models.

What should I do here? Any advice on CRUD patterns for using SubSonic 3 in my MVC project would be welcome and +'d. Also welcome are links to websites that cover this subject for SubSonic 3 but that don't rank high in Google searches...


Asked Rob directly (link here). For my DB, at least, there's a showstopper bug in the generated code. Aaah, alpha software.


UPDATE

With the release of Subsonic3, can we have a little bump to reconsider this question?

0 投票
1 回答
176 浏览

asp.net-mvc - Subsonic 3/ASP.NET MVC 中的 NULL ForeignKeyTo 属性?

问题:基表的主键与 fk 表中的键命名不同。

Subsonic 3 不知道如何处理,这很好,它的测试版。因此,我打算更改 Html.ControlFor 逻辑以获取表格并使用其中的 pkname:

但是 .ForeignKeyTo 为空。ITable 在模板中的哪个位置填充?