views:

298

answers:

2

Hi.

So I want to retrieve data using stored procedures. Preferably via Linq2SQL. So I can do something like this (example):

var productHistory = dbname.StoredProcedureMethod(value);

foreach(var product in productHistory)
{
    //stuff
}

This is something I'd like to be able to do in Visual Studio 2008 in .Net 3.5. It is possible with Visual studio 2008 + .Net 3.5 + SQL Server 2008.

But firstly, I don't like SQL Server 2008 and secondly, I need the database to be absolutely portable. I've always liked SQLite.net, but it is not a direct requirement - as long as the database solution is portable.

I haven't been able to set anything up but Visual studio 2008 + SQLite.Net.

So yeah, I am asking for your help :)

A: 

You are likely to run into a non-movable roadblock: SQLite does not support stored procedures.

AngryHacker
Well are there any alternatives to SQLite then?
CasperT
There are ton of client side embeddable databases - but none of them have stored procedures, afaik.
AngryHacker
+2  A: 

Linq to SQL works only with SQL Server, not with other DBMS. As an alternative, you could :

  • use SQL Server Compact Edition : it is portable, and I think it's compatible with Linq to SQL (could anyone confirm ?)
  • use Entity Framework rather than Linq to SQL. A few months ago, Microsoft announced they would stop support for Linq to SQL, EF is now the "official" Microsoft ORM. It is extensible and can support any DBMS if an adequate provider is available. And the SQLite.NET provider supports Entity Framework, I've been using it successfully for some time now.

Regarding stored procedures, if you really need them you can forget SQLite, because it doesn't support them.

Thomas Levesque
I would just add that you can still benefit from LINQ, even if you don't use LINQ-To-SQL. Specifically, the results of your stored procedures can be queried with LINQ expressions.
DanM
Could you help me with SQL server compact edition? I once tried installing it, but I wasn't able to make a portable db that worked with Visual studio
CasperT
Specifically, it seems I need to add support of SQL Server Compact Edition to Visual Studio.I can't seem to find an installer which does this.
CasperT
I think you just need the latest version of SQL CE (3.5 SP1), which is available here: http://www.microsoft.com/downloads/details.aspx?FamilyId=DC614AEE-7E1C-4881-9C32-3A6CE53384D9. Make sure you also have the VS2008 Service Pack 1
Thomas Levesque