What's a good "mobile" .NET database that supports LINQ? - c#

I'm in the process of refactoring an application and I've decided to use a mobile/embedded database.
I've been reading about SQL Server Compact Edition, but I was wondering if any of you knew of any other databases that could be used and don't have huge download sizes, as my current application is about ~2MB (installer). SQLite would be nice, but AFAIK the GSoC implementation of LINQ-to-SQLite is rather buggy at the moment.
Thanks!

I have tried out db40 once (not the compact edition) - it is an object database. However, depending on your needs it may be a rather comfortable thing to use. They note that they support linq even for the compact edition:
http://www.db4o.com/s/compactframeworkdb.aspx

VistaDB and (as you mentioned) Sql Server Compact Edition are two small options for an embedded database. Sql Server Compact Edition can be used with Linq to SQL or Entity Framework. I believe VistaDB can be used with the Entity Framework.
Also, if you do not require a relational database, you may want to consider db4o. Rob Conery writes about this here.
Hope this helps!

I haven't used it myself, but you might want to look at BlackFish. I'm not sure about its Linq support though, but Delphi supports Linq so it may. Another may be Embedded Firebird - again, not sure about the Linq side of things.

Related

What database should I use for small dotnet Application?

I am developing a small application with ASP and C# in .NET and I want to have a small local database next to it where I can save and retrieve records by either SQL queries or Linq queries. I don't need anything powerful, just something to use instead of keeping records in .txt files.
So what's your suggestion?
Use SQLite
It does not have to be installed and is just a DB File and there are connectors to .Net available.
And you can use LINQ
I would go with either SQLLite or with XML since you are saying very small database.
And with xml you can use Linq to xml
You can use SQL CE or SQLite.
Best to use SQL Express edition since it comes for free. Try using .NET entity framework code first for rapid application development.
In any case application is very small consider using SQL express since you can write neat and clean stored procedures and can play with other database objects.
Please refer http://www.microsoft.com/sqlserver/en/us/editions/express.aspx for more details.
I'll consider SQLite for this purposes.
If you are more comfortable with MS tools, or for some reason (i.e. your company already has a well formed mdb database file) you can use MS Access too, for local and small applications.
I recommend you to use SQL Server Express, becuase
It is free to use and easy to install
You can easily use either Entity Framework or LINQ TO SQL to manipulate your data
It can easily communicate with your company's DB ( if it is also SQL Server), for example, one day in the future, you may need to test the replication.
No one's mentioned it yet so here it is. mySQL and the .Net mySQL client.
In your case I would consider the following:
XML if you don't with more than a couple hundred records in all tables. And #Ali mentioned already LINQ to XML what will be handy.
VistaDB, because it's 100% managed code and require deployment of just one small assembly for both 32- and 64-bit.
SQL CE, just because it's the most popular one. Of course, it supports LINQ and concurrency.
SQLite as an alternative for SQL CE :)
Don't go with SQL Express unless it's been already provided by your hoster. It increases complexity of distributing/installing of your solution.

Where to store application data

I'm building a C#/WPF job search tracking application to keep track of resumes submitted, interviews, followups, etc and am not sure of the best way to store the data. Where/how would YOU store the data? My first thought was XML to keep it simple, but it seems like I should "model" my data since there will be lots of related bits of information. Would SQLite be a better choice? Other recommendations?
Since I assume you want to query and update that data I would even suggest an ORM like Entity Framework - it's easy to get started and the basic stuff like querying and updating will be very straightforward if you have worked with LINQ before - saves you the hassle of writing your own SQL queries. This also will allow you to easily extend your model later on should you decide to do so.
Edit:
There are self-contained light-weight alternatives that would still allow you to use LINQ:
SQL Server Compact:
Microsoft SQL Server Compact is a free
SQL Server embedded database ideal for
building standalone and occasionally
connected applications for mobile
devices, desktops, and Web clients.
Here' an article that describes how to get LINQ to SQL to work on it. Apparently you can also use LINQ to Entities on it but there's quirks (such as design-time support) that you'll have to work around.
SQLLite:
SQLite is a software library that
implements a self-contained,
serverless, zero-configuration,
transactional SQL database engine.
SQLite is the most widely deployed SQL
database engine in the world.
There's a LINQ provider for it called DBLinq
As #Robert Harvey pointed out in his answer there's (almost) full support for EF since there's an ADO.NET provider for SQLLite:
Support for the ADO.NET 3.5 Entity
Framework
Supports nearly all the
entity framework functionality that
Sql Server supports, and passes 99% of
the tests in MS's EFQuerySamples demo
application.
Generally, you want to store the data from your application in a database. For WPF and C#, that database is usually SQL Server or SQL Server Express, because Visual Studio 2008 easily integrates with those.
Do not use XML for this. XML is not intended to be a large scale storage medium; the purpose of XML is to provide a common language for different computer systems to talk to each other.
SQL Server Express is usable on any Windows PC; you just need to deploy the redistributable, using a named instance. See also http://msdn.microsoft.com/en-us/library/dd981032(SQL.100).aspx. If it's a small application and you want to go simpler, you can use SQL Server Compact Edition, or SQLite with the ADO.NET provider.

Which framework and database should i use?

I am looking at creating an application to record gym workout(set,reps, etc) and I was wondering what framework and database backend to use. I am currently thinking C# .Net 3.5 for the framework because I am familiar with it but I'm unsure about how to store the data. Originally I was thinking of xml files and parsing through them but that seems like more work then is needed. If I was to use SQL would I be able to run that from my own machine (Windows 7) and what would be the best method to connect? ODBC, LINQ etc.
Thanks in advance
Linq-to-SQL is a very easy to learn, easy to use and straightforward way to map database tables 1:1 onto domain objects in C#. You can install the free SQL Server Express editions on your machine locally, and use Linq-to-SQL against those.
It has a great set of features, visual designers, and using LINQ queries against SQL Server tables is really quite powerful to use and nice to write.
So unless you have any specific requirements (like supporting backends other than SQL Server or such), I would definitely recommend going with Linq-to-SQL first.
Tutorials:
Scott Guthrie has an outstanding blog post series on Linq-to-SQL and how to use it - highly recommended
The NerdDinner ASP.NET MVC demo app also contains Linq-to-SQL and you can learn a lot from it - great 100+ page intro tutorial as PDF or in HTML format
a bit more advanced: Hooked On LINQ has tons of articles, demos, how-to's and so forth - for LINQ in general and Linq-to-SQL specifically
I would use SQL Server 2008 R2 Express for the backend. It's free and powerful enough for most smaller apps.
Not quite there yet, but this looks like a great place for SQL CE 4.0. Check out ScottGu's post about it: http://weblogs.asp.net/scottgu/archive/2010/06/30/new-embedded-database-support-with-asp-net.aspx
Since it seems to be a small utility kind of application and the database wouldn't be very large I'd suggest to use the SqlCE database. It makes sense to have the database embedded in your app rather than have a server based database. That way you could easily just copy/share your app without having to bother about the database setup.
If you're willing and able to get away from Microsoft solutions. I would highly suggest taking a look at the Ruby on Rails framework as well. It's great for getting things up and running quickly.

What are some good sql databases for home Vista computer?

I have been trying for a long time to get SQL Server Express on my computer to practice my C#/SQL with and I still haven't gotten it to work.
Are there other programs I can use to setup an SQL database to practice with? If so, which are the best ones for Vista?
EDIT:
To be clear I am not new to SQL programming, I just haven't done any in a while and want to stay fresh. So I would like something that has most of the features of forms of SQL I would use professionally.
MySQL or Postgresql are both full fledged DB's and good for education/experimentation. You can also check out Oracles free version.
SQLite is good if you need something fast, small and powerful... its a fast download also.
SQLite
SQLite with C#
What aren't you getting to work for Sql Express. It works on Vista. I use it on a daily basis. It no longer comes standard with a "northwind" database, but you an download the AdventureWorks DB. Can you be more specific about "I still haven't gotten it to work"?
I've also heard good things about firebird
Although I still believe that C# and SQL Express is the best way to go.
SQL Server Express generally should be the natural choice for practice with .NET and C#.
If you have no prior experience in working with SQL Server and its Express version one most confusing thing is that SQL Server Express is not installed as default instance, but as SQLEXPRESS instance. So you have to use "Data Source=.\SQLEXPRESS" in your connection string.
In case you can not overcome issues with SQL Express you can try Postgres, but you will need to download and use .NET Data Provider for Postgres.
I preferr Firebird its a madure BD and its O.S. very stable btw.
http://www.firebirdsql.org/
and try ibexpert for manager this bd.
http://ibexpert.net/ibe/
Both Oracle and IBM offer offer versions of their flagship databases for free in a similar manner to SQL Server Express. Both are excellent products if you wish to play with a 'real' database system.
Oracle 10g Express
IBM DB2 Express
Postgres is also well worth considering as it is also a 'real' relational database, having originally started as the much respected Ingres RDBMS in the 1980s. However Postgress until recently was Unix-based and I've never found it particularly reliable installing on Windows.
Personally I would not recommend MySQL for your scenario - although the latest edition can finally be described as a RDBMS having evolved from what really was a collection of flat files with a limited SQL query interface it's peculiarities probably mitigate against it's use as a learning tool unless you are actually focused on MySQL.
There are a number of other less popular RDMSs you could consider. Firebird has always been something of a favourite of mine as I used to code a lot of Delphi, and SQLite is a joy to work with in many circumstances. It's also a pity you cannot use SQL Server Express as the SQL Server product range is simply the most solid product Microsoft produces and usually my database of choice on anything but the smallest, largest or most unsual installations
Vista DB is quite a nice lightweight managed flatfile database (not related to Windows Vista).
For something very simple look at sqlite It supports most SQL syntax and stores it's database in a single file so has very little setup. You'll need an ado.net data provider for it which you can find here Although it isn't a good choice for multi user systems with lots of data it should be fine for an introduction to database programming.

Can you use LINQ tools such as SQLMetal with an access database?

I'm creating a small database application to teach myself the following concepts
C# programming
.Net 3.5 framework
WPF
LINQ ORM
I want to use Microsoft Access as the database but I can't seem to find any mention of whether its possible to use SQLMetal to generate the ORM code from a Microsoft Access database.
Does anyone know if this is possible?
If not, are there any small database or embedded databases I could use? I think SQL express would be overkill for me at this point.
For an embedded database, you can use SQL Server Compact Edition. Unlike SQL Server Express, it is not compatible with the LINQ to SQL designer, but it is fully compatible with the command-line SQLMetal. It has a few advantages over SQL Express, like to ability to use embedded or run from a file. Microsoft has a very handy chart outlining the differences between Express and Compact.
I don't think SQL Express would be overkill if you want to learn real-world skills - quite the opposite in fact! That'd be my choice, and whatever I chose, I'd stay clear of Access.
Good luck
AFAIK, Linq to SQL is MSSQL server provider specific. To be honest, SQL Express is pretty lightweight on todays machines.
BTW don't confuse LINQ with Linq to SQL. Linq is the underlying technology to provide "query" like support to .NET (amongst other things), where as L2S is effectively a Data Access technology built on top of Linq. Vanilla Linq will work with any ADO.NET provider, which of course Access is one.
Entity Framework will work with any compatible provider also but if SQLExpress is too heavy for you then I wouldn't recommend going down this path...
Thanks for all the responses. I never expected to get an answer this quick. For my test application I think SQL Server Compact Edition would be the way to go. I'm basically creating a money managment app similar to Microsoft Money and although it is an exercise to learn skills, I would eventually want to use it to manage my finances (provided its not too crap!)
This why I thought a fully blown database would be overkill.

Categories