subsonic3

subsonic 3.0.0.3 with mysql can not work in .net 4.0?

半世苍凉 提交于 2019-12-11 06:27:44
问题 i have installed vs2010 beta2, create a MVC website, i want to use subsoinc access a mysql database in SimpleRepository , when run the website, i get error: " Unable to find the requested .Net Framework Data Provider. It may not be installed. ". var repo = new SimpleRepository("NorthwindMySql", SimpleRepositoryOptions.None); var user = repo.Find<Models.User>(u => u.Username == "mm"); ViewData["UserData"] = user; then, i use my vs2008 do the same thing, this time, the website works just fine.

Creating T4 template file referring SubSonic

折月煮酒 提交于 2019-12-11 04:49:58
问题 I am trying to write T4 template to create wrapper classes for classes created by SubSonic 3 (implementing IActiveRecord). But when I compile my template I get following error: Compiling transformation: Metadata file 'SubSonic.Core' could not be found I'm including SubSonic.Core in my settings file. <#@ assembly name="SubSonic.Core" #> and then importing the namespaces like <#@ import namespace="SubSonic.Schema"#> and <#@ import namespace="SubSonic"#> What I'm doing wrong? Do I need to put

SubSonic 3.0.0.3 Update Exception

耗尽温柔 提交于 2019-12-11 03:09:52
问题 When I attempt to update in SubSonic I'm greeted with a Null Reference Exception. This is the exception message I get: Object reference not set to an instance of an object.","StackTrace":" at SubSonic.Query.Update.GetCommand() I've checked the object I'm updating and there are no missing fields, all the class properties match the database column names. Any Ideas what this could be? Cheers Tony 回答1: Apparently this is an issue already found. I've followed what the OP of the issue stated and it

Subsonic 3.0.0.3 Crash

戏子无情 提交于 2019-12-11 02:17:37
问题 Running the latest version of SubSonic (3.0.0.3). Retreiving a single record, making one field change and calling .Save results in a null reference exception in the code below: public void Update(IDataProvider provider){ if(this._dirtyColumns.Count>0) _repo.Update(this,provider); OnSaved(); } My code to create this exception is simply: DAL.MY_QUEUE l_l_itmEngageItem = MY__QUEUE.SingleOrDefault(x => x.id == each.id); l_l_itmItem.date_submitted = DateTime.Now; l_l_itmItem.Update(); Anyone have

Fixes for problems with SubSonic 3's TestRepository

我的梦境 提交于 2019-12-11 00:41:25
问题 I've been trying to use SubSonic 3.0's test repository support for unit testing but encountered a few issues, so I thought I document them, and the fixes I've come up with: Auto-Increment Columns Don't Work Obviously with no DB, auto-increment columns don't work automatically, but if like me you're using simple ints or longs for all identity columns, this fix works well: (This is a copy from here, included for completeness) In ActiveRecord.tt: 1: In the top of the function public void Add

Subsonic 3, SimpleRepository, SQL Server: How to find rows with a null field?

假如想象 提交于 2019-12-10 17:46:09
问题 How ca I use Subsonic's Find<T> method to search for rows with a field containing the "null" value. For the sake of the discussion, let's assume I have a c# class called "Visit" which contains a nullable DateTime field called "SynchronizedOn" and also let's assume that the Subsonic migration has created the corresponding "Visits" table and the "SynchronizedOn" field. If I was to write the SQL query myself, I would write something like: SELECT * FROM Visits WHERE SynchronizedOn IS NULL When I

Subsonic 3 LINQ vs LINQ to SQL

こ雲淡風輕ζ 提交于 2019-12-10 11:41:09
问题 I am using SQL Server 2005 in a project. I have to decide about datalayer. I would like to use LINQ in my project. I saw SubSonic 3 supporting LINQ and I also have option for LINQ to SQL, because i can have typed lists from LINQ to SQL. I am wondering what is different between LINQ to SQL and Subsoinc 3 LINQ, Which is beneficial? Thanks! JAMIL 回答1: In case you haven't read this already, the Subsonic site has a pretty lengthy overview of some differences between LinqToSql and Subsonic (and

How do you change SubSonic 3's connection string on the fly?

可紊 提交于 2019-12-10 11:40:29
问题 I want to wrap some queries in a SharedDbConnectionScope and execute them under a different connection string. How do I add a provider/connection string dynamically in order to do this? Thanks 回答1: Both the ActiveRecord\Context.tt and the LinqTemplates\Context.tt that you would use to generate your classes contain constructors: public <#=DatabaseName#>DB(string connectionStringName) { DataProvider = ProviderFactory.GetProvider(connectionStringName); Init(); } public <#=DatabaseName#>DB(string

use subsonic 2.x and 3.x in the same project

别等时光非礼了梦想. 提交于 2019-12-10 06:33:43
问题 Is it possible to mix them? I'm asking because I have a big project that uses Subsonic 2.x generated classes (in a compiled dll) but would like to start using 3.x for new stuff. I tried it last night with a project where I had references to both subsonic.dll and subsonic.core.dll but that didn't work with ambiguous references, etc. So removed 2.x and then got an issue with my older compiled subsonic generated classes in that they needed Subsonic 2.1 to run. 回答1: Hmm... I think there's a small

Subsonic 3 Save() then Update()?

喜你入骨 提交于 2019-12-09 02:00:01
问题 I need to get the primary key for a row and then insert it into one of the other columns in a string. So I've tried to do it something like this: newsObj = new news(); newsObj.name = "test" newsObj.Save(); newsObj.url = String.Format("blah.aspx?p={0}",newsObj.col_id); newsObj.Save(); But it doesn't treat it as the same data object so newsObj.col_id always comes back as a zero. Is there another way of doing this? I tried this on another page and to get it to work I had to set newsObj