in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

using Active Record design pattern in C# on an sqlite database

Last post 01-24-2010 1:57 AM by fourchu. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 01-23-2010 6:54 AM

    using Active Record design pattern in C# on an sqlite database

    Hi all,

    First of all, thanks Robert for this excellent piece of code of yours.

    I've been a big fan of sqlite for small/medium projects. I've loved using it with ruby & ror.

    I have a java and mostly php background. I am not a big fan of microsoft products but for some reason i just have to deal with C# now.

    So I though I should make a simple c# program at home to get a clear idea of how things work. So basically it was just natural for me to use sqlite for this.

    So all in all, I made my database, tables and populated them using sqliteadmin.

    I've been reading docs for 2 days now. It was rather easy to figure out I would need System.Data.SQLite.dll (and end up on this forum :))

    However, I must say the SQLite driver help file didn't help me much troobleshoot some basic stuff such as


    I can't add any database connection within the IDE.

    I tried trickin into the app.config too ==> that helped opening the sqlite database form the code, but didn't solve the above screenshot

    I tried diggin in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config, but it didn't solve the issue.

    so i have two questions

    1) how can I add a connection to my database from the IDE  Database Explorer, ie troobleshot the above screenshot (i am under the feeling I will have to solve this in order to solve question 2 below)

    2) what is the C# equivalent to an ActiveRecord tool (code generator?) or any other Object Relation Mapping tool best suited on C# / .NET plateform ? and how can I use it with SQLite ? (i've heard of Castle Active Record, NHibernate, dj4o, Linq, Entity Framework,... but don't know where to start really)

     thanks for the hints :)

     fourchette

     

  • 01-23-2010 8:49 AM In reply to

    Re: using Active Record design pattern in C# on an sqlite database

    Unfortunately you can't use the designer with the express edition of visual studio...

    http://sqlite.phxsoftware.com/forums/p/987/4377.aspx#4377

    http://sqlite.phxsoftware.com/forums/t/2165.aspx

    You can still reference the assembly and still use it normally -- you just don't have Visual Studio design-time support.

  • 01-23-2010 9:13 AM In reply to

    Re: using Active Record design pattern in C# on an sqlite database

     ok thanks for the reply.

    i'm totally fine with designer not being available using VS express edition.

    However, in that case, then I would suggest modifying the help section bundled with the lib as it got me confused :)

     

    but anyway, nevermind this

     About the second part of my question, regarding an already implemened Active Record design pattern within .net
    which route should I digg first ?

    Castle Active Record (or NHibernate alone)
    Entity Explorer
    LinQ
    dj4o

    ?

     

    any recommandation here ?

  • 01-23-2010 9:28 AM In reply to

    Re: using Active Record design pattern in C# on an sqlite database

     for instance, i got the feeling "System.Data.SQLite.Linq.dll" is bound to play some role at some point... right ?

  • 01-23-2010 9:28 AM In reply to

    Re: using Active Record design pattern in C# on an sqlite database

    Unfortunately I can't recommend anything as I've never used any of those.  I've got some limited experience with LINQ, but truth be told I like hardwiring my own business logic and found the autogenned stuff both clunky and confusing.

  • 01-23-2010 10:32 AM In reply to

    Re: using Active Record design pattern in C# on an sqlite database

     ok. thanks for being honnest. I think there's a lot of crap with ORM out there.esp if you end up wasting hourstrying o understand what the thing does.

    However, working on an old project a few years ago, I found myself wrinting code that would read db structure and generate php code to do the low level application to database communication (at least for the regular CRUD operations). Then my business logic would simply extends such generate code.

    Once you know what it does and when not to use it, you save a tremendous amount of time and code gets easier to maintain.

    basically it's what rake does and it works like a charm.

    I've watched the 5min demo of Subsonic and I think i got what i'm looking for. but anyway, i'm still surprised you can't get with .NET a decent solution with such trivial things right out of the box like ror.

    i'll post comments about subsonic in case i find it useful.

    Filed under: , , ,
  • 01-24-2010 1:57 AM In reply to

    Re: using Active Record design pattern in C# on an sqlite database

     for the record and googlers who might end up here.

     i find a decent solution with singlerepo from SubSonic. According to the tests i've done so far, it seems well suited for my purpose :

    * small project, common sense first
    * i want libs and tools to get out of my way and do the job quickly
    * i want a decent OR-like solution to develop quickly and focus on the feats, not the useless details(even though it's mandatory to be able to see what's happening from time to time)
    * i like ror-like philosophy

    we'll see with time if subsonic / sqlite was such a good choice, but i have a good feeling about this given the scope of the project.

    definitely checkout this out ==> http://subsonicproject.com/docs/Using_SimpleRepository

Page 1 of 1 (7 items)
Powered by Community Server (Commercial Edition), by Telligent Systems