Tag: subsonic

多个表中具有相同名称的列导致SubSonic Select出现问题

还有其他问题(至少有2个我见过它们)与此类似,但我无法使用它们来解决这个问题。 现在问题是:我有3个表,我只需从中选择4列。 我正在使用InnerJoin并且它工作得很好。 当我添加Where to this Select时,问题就开始了。 我在两个表中有一个名为“Name”的列。 如果我简单地添加 .Where(“Name”).Like(“A%”) 它说“……含糊不清的列名……” 如果我使用完全限定的列名(表格前缀为列名),则必须声明参数@TABLE_NAME SqlQuery sq = new Select(Tables.TableOne + “.” + TableOne.Columns.MemberId + ” AS MemberId”, Tables.TableTwo + “.” + TableTwo.Columns.Name + ” AS MemberName”, Tables.TableOne + “.” + TableOne.Columns.ExpiryOn + ” AS MembershipExpiresOn”, Tables.TableFour + “.” + TableFour.Columns.Name + ” AS Country”) .From(DAL.Tables.TableOne) .InnerJoin(Tables.TableTwo) .InnerJoin(Tables.TableThree) […]

亚音速查询(ConditionA OR ConditionB)和ConditionC

如何在Subsonic中构建此格式的查询 (ConditionA OR ConditionB)AND ConditionC 我试过各种方法,但我似乎无法得到理想的结果。 这是我厌倦的一件事: Query q = Challenge.CreateQuery(); q.WHERE(Challenge.Columns.ChallengeeKey, playerKey) .OR(Challenge.Columns.ChallengerKey, playerKey); q.AND(Challenge.Columns.Complete, false);

亚音速:将SharedDbConnectionScope与TransactionScope一起使用似乎已被打破

使用下面的代码,预期的行为是数据库不会反映更新,因为永远不会调用ts.Complete(),但更新似乎会通过。 但是,如果我省略SharedDbConnectionScope,则可以看到预期的行为。 SharedDbConnectionScope有问题吗? 顺便说一句,我使用的是Subsonic 2.2 using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope()) { using (TransactionScope ts = new TransactionScope()) { // update here } }

Subsonic 3 – SimpleRepository

我正在玩Subsonic 3的简单存储库,并在了解如何处理外键方面遇到困难…… 如果我有一个包含的产品对象 int ID; string name; string description; Category category; int categoryID (this one is just to persist the product’s categoryID to the DB) and a category object containing int ID; string name; 如何使用存储库返回实例化其类别对象的所有产品的列表? 目前我已经编写了一个连接在product.categoryID = category.ID上的linq查询,这一切都很好,但是当我.ToList()查询结果时,产品的类别没有实例化。 有没有办法做到这一点,还是我必须手动实例化每个产品的类别? 谢谢, 保罗