subsonic3

Subsonic 3 : get only certain columns

Hello, I use : Subsonic 3, SQL Server 2008, Json.Net Here is my problem : I have a house table with id,lot number, address, location, ownerid and an owner table with id,name, description. I'd like to get only the owner name and address of house where location is "San Francisco". How can I do this with Subsonic? My problem is I can ...

Subsonic 3.0 Query limit with MySQL c#.net LinQ

Hello, a quick question which may or may not be easily answered. Currently, in order to return a limited result set of data to my calling reference using SubSonic I use a similar function as below: _DataSet = from CatSet in t2_aspnet_shopping_item_category.All() join CatProdAssignedLink in t2_aspnet_shopping_li...

Paging with Find using Active Record

I can't seem to find an answer to this question or a good example of how to accomplish what I am trying to do. I'm sure it's been posted or explained somewhere, but I am having trouble finding the exact solution I need. I am using ActiveRecord in Subsonic 3.0.0.4. When I do something like recordset = VehicleModel.Find(x => x.Model.Sta...

Atomically maintaining a counter using Sub-sonic ActiveRecord

I'm trying to figure out the correct way to atomically increment a counter in one table and use that incremented value as an pseudo display-only ID for a record in another. What I have is a companies table and a jobs table. I want each company to have it's own set of job_numbers. I do have an auto increment job_id, but those numbers a...

GroupBy Count With Subsonic 3

Hi, I like to perform the following with SubSonic 3 without using Linq (using dynamic lookup of columns and tables). Also, no inline sql (to prevent sql-injections). http://www.java2s.com/Code/SQL/Select-Clause/COUNTandGROUPBY.htm mysql> SELECT species, COUNT(*) FROM Bird GROUP BY species; +---------+----------+ | species | COUNT(*) | ...

Simple way to use Foreign Key values for sorting?

Disclaimer: I jumped to C# 2008 recently and SubSonic 3 (3.0.0.4) at the same time. I haven't used Linq for much of anything in the past. Is there an easy way to use the foreign key display value for sorting, rather than the FK Id (which is numeric)? I've added a new Find method in my ActiveRecord.tt to help with sorting based on a st...

Cannot save twice in SubSonic3

Hi. I want to Save my record first to get it auto-populated ID. then make changes later so I wrote as product.Save(); .......... product.image = "/a.jpg"; product.Save(); The problem is the second save doesn't work. I tried to call its IsDirty() and it return false which means subsonic doesn't think it has changed. Actually it has. N...

How to log subsonic3 sql

Hi, I'm starting to develop a new asp.net application based on subsonic3 (for queries) and log4net (for logs) and would like to know how to interface subsonic3 with log4net so that log4net logs the underlying sql used by subsonic. This is what I have so far: public static IEnumerable<arma_ocorrencium> ListArmasOcorrencia() { ...

Extend SubSonic's IQueryable Structure (via LINQ?)

I'm working on a project that groups data by a "customer id". When the user logs in, they're limited to that customer and that customer only. I'm working with SubSonic3, and what I've got looks something like this: public IEnumerable<Models.Foo> FindFoo(int userID, string searchText, int pageIndex, int pageSize) { return from item ...

Error when compiling a WinForms project that uses SubSonic library

The code generation is working but I get the following errors when I try to build the project: Error 4 Source file '...Project Path...\Structs.cs' could not be opened ('Unspecified error ') PPSGenerator Error 5 Source file '...Project Path...\Context.cs' could not be opened ('Unspecified error ') PPSGenerator Error 6 Source file '...P...

subsonic 3.0 - separate generated code from ActiveRecord.vb

I moved from SubSonic 2.x to 3.0 and noticed that all my classes are combined into the ActiveRecord.vb(cs) file. Is there a way to have my classes generated individually in a separate folder (DAL) as I was doing with 2.x? ...

Not getting key value from Identity column back after inserting new row with SubSonic ActiveRecord

I'm sure I'm missing the obvious answer here, but could use a hand. I'm new to SubSonic and using version 3. I've got myself to the point of being able to query and insert, but I'm stuck with how I would get the value of the identity column back after my insert. I saw another post that mentioned Linq Templates. I'm not using those (a...

SubSonic 3 isn't generating Foreign Key tables as a property

Basically, I'm having the same problem as detailed here, but in SubSonic 3.0. Unfortunately, I can't figure out how to change the provider in SubSonic 3.0. Is this something I need to change in the MySQL.ttinclude, Settings.ttinclude or one of the T4 templates? Or does it go in config somewhere? Thoughts? Suggestions? ...

SimpleRepository auto migrations with indexes

I am using subsonic simplerepo with migrations in dev and it makes things pretty easy but I keep running into issues with my nvarchar columns that have an index. My users table has an index defined on the username column for obvious reasons but each time I start the project subsonic is doing this: ALTER TABLE [Users] ALTER COLUMN Userna...

SubSonic 3 LeftOuterJoin

I have read in this forum that left outer join syntax is not supported by subsonic in an answer to a question on the topic by "Apocatastasis". I have the same issue in that when I create a query using the .LeftOuterJoin the resulting sql has an inner join rather than a left outer join. Can someone please confirm that LeftOuterJoin is i...

Subsonic 3 - Sequence contains no matching element

I need help creating a LINQ SQL with subsonic. First the basics, this works fine: var query = (from o in bd.concelhos orderby o.descricao select o); var results = query.ToList<concelhos>(); However, I want to filter out some columns and I have created the following code: var query = ...

Is SubSonic's CodingHorror the only way to do WHERE ISNULL?

I'm trying to do a simple UPDATE ... WHERE ISNULL() using SubSonic ActiveRecord and the only way I can get it to work is by using CodingHorror. eg: public void MarkMessagesRead(long? from_person) { if (from_person.HasValue) { _db.Update<message>() .Set(x => x.is_read == true) ...

How to set up SubSonic ActiveRecord Repository in the ASP.NET MVC Starter Site

I would like to setup ActiveRecord iSession with Ninject IoC just like SubSonicSimple is done. http://mvcstarter.codeplex.com/ Pls help ;) ...

Subsonic 3 ActiveRecord nested select for NotIn bug?

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...

LINQ, "Argument types do not match" error, what does it mean, how do I address it?

Hello, I'm new to linq and I'm trying to databind to an anonymous type. I'm using SubSonic 3.0 as my DAL. I'm doing a select from 2 tables like so var myDeal = (from u in db.Users select new { UserID = u.UserID, UserRoleID = (from ur i...