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.
Related
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.
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.
With the economy the way it is my team and I have been looking into using MYSQL to reduce our licensing costs. I am wondering if there are any gotchas or issues that may crop up.
Is there anything we need ot do special to get .NET to talk to mysql as opposed to MsSQL?
When developing for it will LINQ to SQL have issues?
Any caveats we should be aware of?
Not a direct answer, but if you are familiar with SQL Server, then consider SQL Server Express (2005 or 2008). It is also free, and you'll be familiar with it, thus not requiring research into mySQL ;)
That said, check this out: http://dev.mysql.com/tech-resources/articles/dotnet/index.html
You'll need the MySQL Connector for .NET, if you don't already have it, in order to get your .NET application talking to MySQL.
Then you'll have access to MySqlConnection, MySqlCommand, MySqlDataReader objects etc.
LINQ to SQL is for SQL Server only, but there are third-party LINQ providers for MySQL - here's one that looks promising, although I haven't used it myself.
one big one is the support you can get when working with MYSQL if you dont pay the license.
Microsoft hasnt develop yet LINQ to MYSQL support, it maybe some projects out there but they are not guranteed
Here is a post which shows the matrices of the comparison. The database feature section is worth to look at.
http://swik.net/MySQL/MySQL+vs+MS+SQL+Server
Well, I say you're doing the right thing moving to MySQL. SQL Server's licensing cost is prohibitive and since MySQL does the job free and has no limitations like the Express edition I think using it as a backend is a solid idea.
I've used SQL Server express for more than a year now and what irks me most is that it under-uilizes the server's resources so you're not getting enough bang for the buck with express edition. If you have a website with plenty of data or one that gets plenty of visitors then you'll quickly outgrow SQL Server express, and then you'll find that you either have to somehow win a lottery to get the money for the full edition or re-write all your queries for a cheaper DB.
So better plan ahead, go with a cheap DB in the backend. MySQL is a very good choice.
You could just ignore the database being used an opt to use an ORM. That way you won't have to care what database you're using, and move between them (atleast in theory), effortlessly.
Try SQLite. I've used it and really enjoy it. There's even a free admin tool that has AutoComplete (wow). It's suitable for any site that has less than 100k page views per day. There are some downsides to be sure, but the light footprint and compatiblity with LINQ (via DBLinq, which is still in Alpha but I've used it just fine) make it a win in my book.
Be aware that the MyISAM engine doesn't support transactions, whereas InnoDB does.
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.
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.