2

Roughly a month ago (after christmas) i found this post and realized how useful reflection is. So i decided to learn and got carried away and spent around 10days on this which became a ORM for sql(ite).

My question is, is there anything wrong with this ORM is used? I never used an ORM before and i heard you should not write one yourself. I dont see what is wrong with mine except maybe lacking functionality compared to others. So what is wrong with this ORM? (Links below)

The idea was i should write class normally, avoid tagging fields with attribute as much as possible and to insert extremely easy. I though update logic may be too complex and the user really should write the queries instead of assuming, getting things wrong or play a game of how to tag the class. So theres none of that, just simple inserts and filling up your own queries if its trivial. I wrote a tutorial for my friend 2 weeks ago. It seems to compile and run, so judging by that what is wrong with my ORM?

http://codepaste.net/29xkub
http://codepaste.net/qnrira

Also i dont want to continue this and have it grow. So far i used it in 3 projects and had no problems but is there another ORM that does what this does? foreign keys are a must and ATM i dont have this implemented solely because i am waiting for http://sqlite.phxsoftware.com/ to update to 3.6.19+

Community
  • 1
  • 1
  • 4
    You can invest hundreds of hours into your custom built ORM and you still likely won't catch up to NHibernate. Enjoy it as a hobby, but try not to take it too seriously. Building a custom ORM is a great educational experience. – Michael Maddox Jan 29 '10 at 16:51
  • I don't understand why this question was closed. Could someone fill me in? – Dathan Jan 29 '10 at 16:57
  • @Dathan: Its too bad it was. I wont be learning a ORM since this handles everything i need ATM. So i guess i wont be learning what a real ORM can do or what is poor about this for a while (either until i learn another or get myself into trouble) –  Jan 29 '10 at 17:17
  • @Michael Maddox: It was to learn reflection not to learn how an ORM works. Its done unless i do foreign keys and not learn a real ORM. Part of my question is what ORM can do what my example does because i am sure something like mine exist and is better. –  Jan 29 '10 at 17:19

1 Answers1

3

The only reason for not writing one yourself is similar to why you would use the .net framework - it's already been done, probably been used in anger in a number of projects and has probably dealt with whatever edge cases you have not thought of...

Paddy
  • 33,309
  • 15
  • 79
  • 114
  • The problem is i dont know anything about ORMs. I know i shouldnt write libs because it grows thus I dont want to write and asked what can do what my example does. This seems good enough and only has 10days. I know i shouldnt write more and i plan not too but what does what my example does? I seen NHibernate and it doesnt appear to do what mine does and Subsonic doesnt seem to do multiple inserts nor foreign keys. –  Jan 29 '10 at 17:23