subsonic3

subsonic 3.0 how to correctly close connaction?

I'm using Subsonic 3.0.0.3 Active Directory. During program work, opens many connections to MySQL data base. I can see this threads in MySQL Administrator. I'm working with data base in this case: var db = new DB(); var nClient = Enumerable.First(db.clients, c => c.id_client == cl.ID); nClient.data = data; nClient.Update(); another ex...

Subsonic 3 LINQ vs LINQ to SQL

Hi, 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? T...

How to generate database class files with SubSonic 3?

I've been using SubSonic (ActiveRecord) for a couple of years. I've been waiting until a few of the bugs in 3.0 were fixed before downloading the newest release and upgrading my few sites that use SubSonic to 3.0. I'm currently using 2.2 on these sites. I'm working on a new site and wanted to use 3.0 to get a grip on the new updates befo...

How to intersept the save method on ActiveRecord?

Hi! I need to intercept the Save method, do some validations, alter some properties and then let it go again normally. How can I do this? Thanks! Alex ...

subsonic, mvc and activerecord

hi, i am using subsonic 3.0 and active record with a mysql database now everything is fine, but i cant seem to create views see example: public ActionResult Index() { return View(contact.GetPaged(1,20)); } now normally i would right click and choose Add View i would then choose strongly typed and find the class for the...

SubSonic 3 / ActiveRecord - Easy way to compare two records?

With SubSonic 3 / ActiveRecord, is there an easy way to compare two records without having to compare each column by column. For example, I'd like a function that does something like this (without having to write a custom comparer for each table in my database): public partial class MyTable { public IList<SubSonic.Schema.IColumn> C...

ActiveRecord and GetHashCode fails if int is nullable.

There is a problem when the int is nullable on GetHashCode At the point of GetHashCode on ActiveRecord.tt there is a need for a nullable check. Something like this. <# if(tbl.PK.SysType=="int" && !tbl.PK.Nullable ){ #> public override int GetHashCode() { return this.<#=tbl.PK.CleanName #>; ...

SubSonic 3 - Simple repository - One to many relations

Hi, 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 th...

How to execute SubSonic3 StoredProcedure with return value

How do I execute a SP and get the return value. The below code always returns null object. The storedprocedure has been tested in the database using the same parameters as in code, but the SubSonic sp always returns null. When executed in the db via sql, it returns the correct values. This is using SubSonic 3.0.0.3. myDB db = new myDB(...

Subsonic 3 + LINQ bug

A weird bug with Subsonic 3.0.0.3 Using - as an example - AdventureWorksLT DB When I run this code I get null for gname (although name gets the value ok) And w is 0 instead of the value in the 1st row [If I change select new MyData to just select MyData - it works OK] class Program { static void Main(string[] args) { var q = fr...

How to fix a issue in Subsonic 3.0.0.3 in IQueryable

case1: int categoryID = 1 DB db = new DB(); Shop_Category o = db.Shop_Category.SingleOrDefault(cat => cat.CategoryID == categoryID); get value of o.Status have error; No mapping exists from object type ShopVN.CategoryMgt+<>c__DisplayClass0 to a known managed provider native type. case2: const int categoryID = 1 DB db = new DB();...

How do I persuade VS2008 to run .tt template files?

Following the words-of-one-syllable walkthrough should get my demo app working, right? But I fell down twice so far and I'm only up to step 4 in the 5 step process :( 1 Create a new project in Visual Studio 2008 Done that, yayy! 2 Add a connection string to your Web/App.config, give it a name, and point it to a valid database Done ...

is Subsonic 3 compatible with the latest release of Mono?

The latest stable release of Mono right now is 2.4.2.3. Does subsonic 3 work with it? I know Mono isn't compatible with all .net 3.5 features yet, but I'm presuming compatibility depends on which specific language features of .net 3.5 Subsonic uses. Does anyone know for a fact whether it's compatible? ...

Compile error using SubSonic ActiveRecord templates in Visual Web Developer Express

Thanks to ranomore I was able to get the Subsonic T4 code generation to work in Visual Web Developer Express for my ASP.Net MVC project, however only using the LinqTemplates. When I use the ActiveRecord templates with the same settings my project does generate files, but the code doesn't compile anymore... Any ideas? ...

Active Record and Linq T4 Templates problem

I've started a C# web application project using subsonic 3.0.3 as my DAL and SQLite for database. It doesn't have any problem when using SimpleRepo, but the problem occurs when I try to use ActiveRecord/Linq T4 templates. It says "Metadata file 'System.Data.SQLite' could not be found". The settings.ttinclude is the one provided with SQLi...

Problem about SQLite's integer and int datatype

I meet a problem about: Object of type 'System.Int64' cannot be converted to type 'System.Int32' when run the SubSonic.Examples.SimpleRepo project base on SQLite provider. I fond that the data type for table Categories's column CategoryID is 'integer', and the 'integer' in SQLite will be return as Int64, in the same time the CategoryID'...

Problem about ActiveRecord Templates for SQLite

I try to using the SQLite in SubSonic.Examples.ActiveRecord project so: Add a reference for System.Data.SQLite Copy the SQLite.ttinclude and Settings.ttinclude from \T4 Templates\TemplateProviders\ to the Models_Generated\ Change the <#@ include file="SQLite.ttinclude" #> in the SQLite.ttinclude and Settings.ttinclude Change the settin...

subsonic 3.0.0.3 MVC2 how to work paging Model.HasPreviousPage not working

HI i wish to have some nice paging for my subsonic project, i am fine with the code behind however i cant find any information with regards to paging on the view side of things ??? i have tried Model.HasPreviousPage but this no longer exists, so am all out of ideas on where to even begin, is there some hidden manual for this stuff so...

T4 Templates - SubSonic 3 - Running at Build Time

How do you get the SubSonic 3 T4 templates to rerun prior to building in VS2008? I don't have to continually "Run Custom Tool" on each one? ...

SubSonic 3 ActiveRecord Issues - Blank Data

When I examine the .Columns property of one of my business entities I had missing values for Table and PropertyName. I get the right count of records back from things like Take(5) but all 5 objects will be full of empty strings and 0 values. Just tried it with another SQL connection and same thing? Where should I start troubleshooting t...