Discussion Locked

Automatic synchronization of database schema with Linq to Sql model.

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi all!

It's not a secret that LINQ to SQL doesn?t provide ability to automatically synchronize database structure with object model. It seems that a lot of developers are waiting when this problem will be solved.

Probably, this will be a solution:

http://www.perpetuumsoft.com/Product.aspx?lang=en&pid=55

Can somebody advise on it? I really need a qualified answer.

11 replies

by tony hopkinson

It cannot be done.
All it takes is a couple of lines of code.
Bollocks.
Let's take a really simple change, a column name.
I had two columns in my table,
Column_1 and Column_2.
Someone else comes along and doesn't like underscores.

Now if I have a function in LINQ, in a string of SQL or even a stored procedure that does something like
ColumnName = String.Format("Column_{0}",_ColumnNumber)
auto synchronisation is f'ed.

Auto synchronisation will limit what you can do without breaking it always.
It's just another facet of auto code generation, it will work as long as you stick within the scope of the code generator. I don't care how clever you get, I can posit a situation where it will fall on it's arse, waste of resource in an effort to avoid thinking about the impact of a change.

by krotova-d

Probably, the column name changing is not simple changing in the database structure, because this changing is placed in the "Refactoring"\"Complicated changes" part in the article that is here: http://www.perpetuumsoft.com/Product.aspx?lang=en&pid=55&tid=automaticsynchronization. This is an article about the using of this tool.

I found this article in Wikipedia (http://en.wikipedia.org/wiki/Automatic_synchronization_of_two_database_schemas).

But other changes : column type changes, column\table adding are executed easily. It seems that it really limits the spectrum of possible operations on database structure changing.

But it is better than nothing...

You know, It would be bad joke just to post about a tool that is nothing than rubbish.

I know that the problem is discussed and a lots of people are waiting for this solution, I think some of them will be really happy to look at it and what is why I try to start a discussion here and ,maybe, help.

by tony hopkinson

What does it do, when it hasn't been coded to cope with a scenario?

Every tool I've ever seen like this and if you think this is a new idea, you need to get out more, goes down one of three routes.

It will blow chunks, and say you've done it 'wrong'

It will take some guess and make an arse of it.

It will reinterpret your intentions and do something completely different that won't cause the TOOL to blow up. The latter usually means you end up with flakey, unenhancable, unoptimised, overly verbose drivel.

I have this tee-shirt, I wiped behind my ears with it, and threw it in the bin, about 1988.

Yet another panacea, to be marketed to Gartner types, so they can employ glorified clerks instead of real developers.

I am here to help too.
Warning to my less experienced peers, in any non trivial application, particulary one with a aging code base, a tool like this will be worse than nothing.

I aren't happy with the code LINQ generates for databases in some cases !

A miracle, a miracle would be a note on the shelfware that says this is all the things it won't do.

by jaqui

at 6 am I was talking with a friend who had just gotten out of bed to go get me coffee.

He was talking about a GUI db admin tool that would connect to any DB engine available and would export from any to any.

He wanted to add to the tool the ability to recode all stored procedures / queries, and optimize db structure and query to work with each engine.

We spent 20 minutes talking about how much garbage would be in ANY generated query, how bad the query would perform, and how much work it would add to any dbadmin to make the generated code worth using.

I convinced him that the connection / administration tool would be useful, since it would be one user interface for every engine, making it much easier for DBAs to work with different engines. I also suggested that the tool only have the ability to edit the files for porting, so that the DBA could have it working right without having to rip out tons of generated bloat.

by tony hopkinson

Well OK I can see lets con some poor numpty into buying it and get a good grip on their curlies.

Use WEB pro to design your WebSite without knowing HTML
Use TablePro to design your database without knowing what a database is
Use CodePro to link your WEB Pro web site to your TablePro Database without knowing how to program.

I mean ffs, even if you were the best coder in the entire f'ing universe, how in hell's name do you know what I need better than I do?

It's just arse!

by jaqui

why I talked him out of doing the code generation.

like I said, a GUI that will work with any database engine, with the ability to make or edit queries / stored procedures.
dump the db into sql inserts
run a db dump to restore a db
allow the END USER* to edit db structure / queries to port to a new engine if desired.

that would be useful.

one tool / app for Oracle, MSSQL, MySQL, Postgresql ...
yup, that would make it a lot easier for any DBA to work in a varied environment.

* End User being the DBA, not the person accessing them for regular work.

by jaqui

Dreamweaver, MS Visual Studio, Flash, JBuilder, C++Builder, ...

the code generators that is what they are being taught is the right way to work.

until code generators are prohibited in the workplace completely, they will continue to be promoted and morons will continue to think they are a good thing.

by tony hopkinson

The form design side which could be classed as auto generation doesn't bother me. Things like autogenerated datasets and data binding, I consider tools for novices in a hurry where quality isn't an issue.
Not very good novices either...

The bloat that is .NET or the VCL frameworks, is just the price of doing business in the environment in which I work. Unlike many though, I can and do write my own components when I can justify the effort to the business types. The purist reasons like saving a bit of footprint, performance or just aesthetics is not something they'll wear.

However I at least know what compromises I've made.

by jaqui

to code generators, the biggest pro is speed of development

the biggest con is cost in hardware for using the code.

I do like the UI design aspects of them, and the code for that is usually fine.
it's everything else other than user interface where code generator code is useless. how much optimization is possible in user interface code? not much, with widget sets and inheritance etc.. you aren't gaining a lot to go through and remove those methods you never call, when in a future version you might find you need them.

by tony hopkinson

The one thing guaranteed to p*ss me off though, is when some lazy git picks the wrong ancestor to use some similar code from something completely unsuitable and then starts hacking the resulting component to make it fit badly.
Course that's not just a fault of OO and IDEs, how many times has some arse used a library routine and thenm bent the crap out of it to get what they need.

9/10 it's aways quicker and better to say no that won't do and start from scratch if necessary.

Reuse abuse, guaranteed to light my blue touch paper.
Unfortunately an extremely common sin in today's code generated environments.

by jaqui

to being open source software as I am, if I only need to use a small set of functions from a particular lib, I can rip them out and make a lib that only has that functionality needed.
[ keeping functions called by those I need from the lib as well, naturally to anyone who isn't a code generator only developer. ]

good code generators, GLADE, for building GTK based GUI [ includes possible support for c, c++, perl, python, wxwidgets, ruby ]
QTDesigner, which uses the bloated QT widget set. [ base for Delphi widgets which are used by all borland tools. ]

The other tools are either modified versions of above, or code generators like MS VS.

This discussion is closed to new replies.