Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Access 2010 - A Better Way To Generate Classes?

EF ADO sql database

  • Please log in to reply
3 replies to this topic

#1 SoulFireMage

SoulFireMage

    CC Newcomer

  • Member
  • PipPip
  • 22 posts
  • Location:Uk
  • Programming Language:C#, (Visual) Basic
  • Learning:C#, Python, Ruby, Lisp, Transact-SQL, Haskell

Posted 06 June 2012 - 11:20 AM

Hi guys,

I've got a problem that I keep going round in circles with and I'm a bit fedup of it.

Im' stuck with MS Access 2010 for a content database. The db is used locally on 400 pcs and cannot be swapped for a real database for various legacy reasons. So any tools I want for developing content have to talk to Access 2010 and that's it.

Now I've upscaled it twice to Denali and SQL server 2008. I learnt how to play with Entity Framework to a simple level, meaning I can get a nice LINQable list out of it. I've a fair few tables and columns to update and work on.

However, in real life, my toy EF projects can't go further because it's back to handcrafting the data layer all over again. All the while knowing that there is definitely somehow, better ways than manually writing the classes and making sure the column name and class property name are the same.

We did have a code generator, not written by me, but sadly it was built to bind Winforms directly to it and the source isn't in my control and not kept up to date. So no PK detection, relies on convention only for ID etc.

So at the end of all that and having just run through a quick look at NHibernate, can anyone suggest a way to do this that doesn't involve hours of hand crafted classes for each table? I should add that its an in house content editor, not a client facing tool.

Thanks for any advice offered!
  • 0

#2 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 06 June 2012 - 08:07 PM

did you hear about codesmith ?
it read the database tables and fields and make up your classes, you can also template how do you want the classes to look like:

here the site :

http://www.codesmithtools.com/

there is many code generators, but i've seen this one working at large scale so i trust it.
  • 0

#3 SoulFireMage

SoulFireMage

    CC Newcomer

  • Member
  • PipPip
  • 22 posts
  • Location:Uk
  • Programming Language:C#, (Visual) Basic
  • Learning:C#, Python, Ruby, Lisp, Transact-SQL, Haskell

Posted 06 June 2012 - 10:25 PM

This looks exciting! On iPad just now, will look later today in depth but if it can handle our access db I'll owe you a beer!

Very much appreciated, this is the sort of thing I'm needing. My own code was getting rubbish, I've only a loose grasp of using interfaces or even using properties properly-despite knowing the theory!
  • 0

#4 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 07 June 2012 - 12:56 PM

hiya again soulfire,
man, do i like beer ! best recon ever ! ** with likes,+1, etc, beer is the deal !!

i think it will not have trouble reading your access db provided you pass it by odbc, codesmith is good at reading tables and making the classes, DALC, business, etc
it also would make the stored procedures for basic operations as Adding, erasing and modifying records should you be working in sql server.

i hope it does the trick for you, make me know how it goes
  • 0





Also tagged with one or more of these keywords: EF, ADO, sql, database

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download