subsonic

.NET - ORMs and all possible combinations - ViewModel?

How would you approach this problem with an ORM? This is a hypothetical (simplified) example: I have a table of cities: 1 - New York 2 - London 3 - San Francisco 4 - New Orleans I have a table of scores: (first column Unique Primary Key, second Month Code, third FK to City, fourth Score (int)) 1 - 352 - 1 - 9 2 - 352 - 2 - 10 Fo...

subsonic stored procedure call timing out

Hi, I am experiencing weird behavior when trying to call a stored procedure using subsonic from a website. I am getting "time out expired" error when I call the stored procedure using subsonic. If I execute the same stored procedure in sql server management studio, it runs instantly. I am not knowing what the problem is. I cannot step i...

Trouble getting started with SubSonic

I have a domain model in my head, and i am having problems building a SubSonic compatible db schema, it would realy help me get started if you could tell me how you would go at it for this example with 3 entities (could be SqlServer OR MySql doesn't matter to me) Subject- representing an educational subject (e.g. Trigonometry, Calculus)...

Can you do an inner select with Subsonic?

This is my sql query: subsonic version 2.1.0.0 No Linq (.net 2.0) select ( select Title from MenuTranslation mnu2 where mnu2.languageid = 1 and mnu2.menuelementid = menutranslation.menuelementid )as BaseTitle, * from menutranslation inner join menuelement on menuelement.id = menutranslation.menuelementid where menuelementid in (sel...

When and how can I enforce validation in Subsonic 3?

Is there any event like OnValidate in LINQ where I can add my business validation rules so that they are ALWAYS called whenever I use Add() or Update()? If not: What do you suggest to do? I could add a partial class and wrap the Add/Update methods with own ones but then one could still use the original ones ignoring any business valida...

Subsonic 3.0.0.3 not generating parameters for stored procedures

I have a SQL Server 2008 database with a bunch of stored procedures. When I use the ActiveRecord Template provided with Subsonic 3.0.0.3, it generates methods for all of my stored procedures, but they do not have any parameters. I am dbo on the server and can execute the stored procedures with no issue from Management studio. Example St...

Subsonic 3 using User.Identity.Name versus Environment.Username for Audit Fields?

Hi, Using Subsonic v3.0.0.3 and seems the Update() and Add() methods are using the Environment.Username for the ModifiedBy and CreatedBy fields. What would be the best way for me to get this to use the MVC/Asp.net User.Identity.Username as there are many 'Bob' names in our user collection and currently having a new record created with C...

SingleOrDefault query returns null (sometimes) even though the data is there

I'm a SubSonic newbe and am writing my first app with it. I have a database with two tables called Member and Club. The Club table has three fields which link to the primary key (ID) in the Member table (PresidentID, VicePresidentID, and TreasurerID). If I make three calls to Member.SingleOrDefault, they all return valid data. i.e.: Pre...

Subsonic 3.0 SQLite FormatException parsing DateTime?

I have an MS Access database, which I have converted to an SQLite database. I have SubSonic setup and working, and I can pull data out of the database successfully into a WinForms app using ActiveRecord. All except for one table. I get a FormatException, "String was not recognized as a valid DateTime". The format of the date column in t...

Subsonic Compare Two Objects

I would like to use this generic CompareObjects class but it seems that the Subsonic record objects don't implement IComparable. User userFromDB = User.SingleOrDefault(x => x.UserName == "CmdrTallen"); User modifiedUser = new User(); TryUpdateModel(modifiedUser); if(CompareOjbects<User>(userFromDB, modifiedUser) != 0) { this.log("U...

How can I customize the generated classes in SubSonic 2.2

I'm using SubSonic 2.2 for my DAL. To match the requirement, I need to customize some of classes which generated by SubSonic. For sample: public partial class Category : ActiveRecord, IActiveRecord, IOtherInterface Could you please give me some clues. Where I can modify the generated template? Thanks! ...

Problems with encoding

I'm using MySQL 5.1 and Susbsonic 3.0.0.3. Database and all tables are in cp1251. I have problems with saving russian symbols. After saving it looks like "?????". How i can setup subsonic to save symbols in cp1251? P.S. With reading everything is ok. ...

SubSonic.SqlQuery Distinct

How do you do DISTINCT with SubSonic.SqlQuery and not Query? I am using Subsonic 2.1 and can't seem to find DISTINCT Thanks ...

Subsonic 3.0.0.3 SQL Paging using Linq

Have just updated from Subsonic 2.2 ActiveRecord to 3.0.0.3. I am trying to use LINQ to do a paged Find query like this (my object/table is called "Repository"): Repository.Find(item => item.DocumentTitle.Contains(searchTerm)) .OrderBy(i => i.DocumentTitle).Skip((currentPage - 1) * itemsPerPage) .Take(itemsPerPage); When I v...

Can I run Subsonic 2.1 and 3.0 side by side

I have a small code base using Subsonic 2.1 in my project. I would like to start using Subsonic 3.0 as soon as possible. But I don't currently have resources to convert the 2.1 implementation. Is it possible to start using 3.0 for new code and leave the 2.1 code running. Will I have any special conflicts. Anything I should watch for? ...

Pagination not working Subsonic

I am having trouble with the pagination. It does not work, i.e. List staffs count is always zero for the code below. If I remove the Paged method, correct results appear. How else can I solve this? I am using Subsonic 2.2. Pls help - thanks SubSonic.SqlQuery query = DB.Select().Paged(startIndex, pageSize) .Fr...

how to save null value in subsonic

Dim xbg As Rm xbg.LobId = cmb_lob.SelectedValue xbg.Mobile = mobno.Text xbg.BusinessFax = faxno.Text xbg.BusinessPhone = phno.Text xbg.Save() I have a combo box, which is not mandatory while input in the module. therefore user can select blank value in combo cox for which i want to save null in Oracle Database for that record. I had ...

SubSonic SimpleRepository Updates Cause Null Reference Exceptions

In researching the SubSonic's new SimpleRepository, I've found that calling the Update() method always throws a NullReferenceException. This is even true in the sample MVC download that's included with the 3.0.0.3 release. Does anyone know if there's a way to get updates to succeed? Here's an example. The if statement works; it a...

Using Subsonic with Firebird

I have a dotnet application written for Firebird and am planning to use Subsonic with it. Does anybody have any experiece with it. Are there any major issue with it ? Any help would be appreciated. ...

Subsonic 3.0: How to use LIKE on objects?

New to Subsonic 3.0 and wondering how to perform LIKE operators on object attributes. Given the following class, how would I perform a LIKE operation using Subsonic 3.0. For example SELECT * FROM categories WHERE name LIKE '%foo%'; public class Category { private String categoryID; private String name; public Category() ...