subsonic

Subsonic 3 - Update NullReferenceException

做~自己de王妃 提交于 2019-12-08 05:25:10
问题 I am using Subsonic v3.0.0.3 with the Linq templates. I am attempting to update a record in a SQL Server Express database with the following: var db = new MyDB(Constants.Database); db.Update<Contact>() .Set(d => d.FirstName == contact.FirstName) .Where(d => d.Id == contact.Id) .Execute(); I am receiving a NullReferenceException when this line is executed. The stack trace is as follows: at SubSonic.Query.Update.GetCommand() at SubSonic.Query.Update.Execute() Any chance that someone may be able

Column with same name in multiple tables causing problem in SubSonic Select

三世轮回 提交于 2019-12-08 05:13:11
问题 there are other question (at least 2 I've seen them) similar to this but I'm not able to solve this using them. Now the problem: I've 3 table from which I need to select 4 columns only. I'm using InnerJoin and it is working perfectly. Problem starts when I add a Where to this Select. I've a column named "Name" in two tables. If I add simply the .Where("Name").Like("A%") It says "... ambiguous column name.." If I use fully qualified column name (with table prefixed to column name) it says must

SubSonic 3 - Simple repository - One to many relations

别来无恙 提交于 2019-12-08 04:55:00
问题 It's the first time I use Subsonic. Let say I have those classes : public class Store { public int Id { get; set; } public String Name { get; set; } } public class Employee { public int Id { get; set; } public String Name { get; set; } } An employee is related to a store with is hired date. This means that in the database I will have a middle table With StoreId, EmployeeId, StartDate, EndDate UPDATE An employee can work to the StoreA from 2009-01-01 to 2009-04-04 and work for StoreB from 2009

Subsonic 3 ActiveRecord nested select for NotIn bug?

偶尔善良 提交于 2019-12-08 01:01:27
问题 I have the following Subsonic 3.0 query, which contains a nested NotIn query: public List<Order> GetRandomOrdersForNoReason(int shopId, int typeId) { // build query var q = new SubSonic.Query.Select().Top("1") .From("Order") .Where("ShopId") .IsEqualTo(shopId) .And(OrderTable.CustomerId).NotIn( new Subsonic.Query.Select("CustomerId") .From("Customer") .Where("TypeId") .IsNotEqualTo(typeId)) .OrderDesc("NewId()"); // Output query Debug.WriteLine(q.ToString()); // returned typed list return q

how to modify SubSonic 2.1 code generation

强颜欢笑 提交于 2019-12-08 00:55:22
问题 I would like to add basic logging and make some other minor changes to the classes generated by SubSonic 2.1 (I'm not using SubSonic 3.0 t4 templates). Is there a way to do this without modifying the SubSonic source code? 回答1: You have two choices. You can modify the default templates or create your own. I suggest making your own templates which will lives side-by-side with the original and then generate your code via the following instructions. Note that these steps assume you ran the

Subsonic support for Oracle ODP.NET?

戏子无情 提交于 2019-12-07 16:50:16
问题 I'm new to Subsonic and I work primarily with Oracle databases. Can subsonic be used against an Oracle database and does it support the use of Oracle's ODP.NET data provider. If yes, can you point me to a good example? Thanks in advance. Scott 回答1: Marve is a little misleading. Subsonic can be used with Oracle but SubSonic 2.x actually uses System.Data.OracleClient . Subsonic 3.0 does not have any .tt files for Oracle yet as no one has stepped forward to do it. I have been using Subsonic 2.2

SubSonic2.2 SharedDbConnectionScope and TransactionScope Transaction Confusion

蹲街弑〆低调 提交于 2019-12-07 16:18:37
问题 ARGH!!! There seems to be a little confusion surrounding the SharedDbConnectionScope and TransactionScope objects to enable wrapping your SubSonic queries within a transaction. The docs suggest specifying the using SharedDbConnectionScope wrapped around the using TransactionScope... using(SharedDbConnectionScope scope = new SharedDbConnectionScope()) { using(TransactionScope ts = new TransactionScope()) { // do something ts.Complete(); } } Then other question here such as Subsonic: Using

Using SubSonic in VB.Net web application

a 夏天 提交于 2019-12-07 12:01:28
问题 I am using Subonic in a VB.net application for the first time (I have used it succesfully in a WebSite project plenty of times). I followed the 2nd part of the 'Getting Started' video to actually generate the DAL source files as opposed to the build provider method and everything APPEARS to have gone like expected. However, nothing I do will get my generated namespace to appear. I feel that it has to with the fact that I am running my Web Application in VB.Net and Subsonic generates in C#.

subsonic 3.0 , The SqlServer default value doesn't work?

喜夏-厌秋 提交于 2019-12-07 03:44:29
I used subsonic 3 with T4,It's very simple to use.But I get a problem now.I specify the default value in the sqlserver 2005.Then I called save() method in subsonic.I found the default value doesn't work. Default values won't work on inserts because your object will set the value first - whether it's null or ... whatever. The answer here is to set the default on the object. 来源: https://stackoverflow.com/questions/1171025/subsonic-3-0-the-sqlserver-default-value-doesnt-work

SubSonic 3 - Simple repository - One to many relations

拜拜、爱过 提交于 2019-12-06 15:56:35
It's the first time I use Subsonic. Let say I have those classes : public class Store { public int Id { get; set; } public String Name { get; set; } } public class Employee { public int Id { get; set; } public String Name { get; set; } } An employee is related to a store with is hired date. This means that in the database I will have a middle table With StoreId, EmployeeId, StartDate, EndDate UPDATE An employee can work to the StoreA from 2009-01-01 to 2009-04-04 and work for StoreB from 2009-04-05 to ... And I don't want that my data table repeat all the information of my employee each time