Refresh Linq Data Entities in the Model

  • Thread starter Thread starter Matthias S.
  • Start date Start date
M

Matthias S.

hi there,

i have generated a database model using vs and a *.dbml file. there are
a lot of tables in the database and all of them are prefixed, like
xxCustomers, xxOrders. for the generated entities i don't want those
prefixes so i removed them in the design view of the model which works
fine. my problem now is, that we are still changing little bits in the
table definitions (adding columns, renaming them and the like), and i
need to "refresh" the model. but while doing so, i don't want all
classes to be newly created (and have the table-prefix again). is there
a way to do this?

thanks for any help in advance.

matthias
--
 
Matthias said:
hi there,

i have generated a database model using vs and a *.dbml file. there
are a lot of tables in the database and all of them are prefixed, like
xxCustomers, xxOrders. for the generated entities i don't want those
prefixes so i removed them in the design view of the model which works
fine. my problem now is, that we are still changing little bits in the
table definitions (adding columns, renaming them and the like), and i
need to "refresh" the model. but while doing so, i don't want all
classes to be newly created (and have the table-prefix again). is
there a way to do this?

thanks for any help in advance.

No, linq to sql doesn't support model refreshing in the designer.

FB


--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
hi frans,

thanks for your reply. is there a workaround? i mean, things change in
a development cycle, or not? what you've said seems to render the whole
database model thing useless.

kind regards,

matthias
 
Remove and re-add the table, or (more likely) hand-edit the dbml (xml) file.

I believe the Entity Framework designer is a bit more intelligent (I
haven't got CTP machine handy, but I'm sure I've seen a button to do
this; can't say for sure though...) - and it /could/ (pure speculation)
be that the LINQ-to-SQL designer inherits some of this capability when
the VS2008 update ships later this year. Maybe.

Marc
 
Matthias said:
hi frans,

thanks for your reply. is there a workaround? i mean, things change in
a development cycle, or not? what you've said seems to render the
whole database model thing useless.

You know, your post made me think abit about shipping a set of
templates for LLBLGen Pro to generate linq to sql code/mapping file.
Our designer does support model updates when databases change.

Other than that, I don't know of any workaround other than re-building
the model in the vs.net designer. I also agree with you that not having
this merge feature is really a big oversight.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
Hi Marc,

thanks for your reply. Yes, even after doing some research on it, if
come to the point that hand-editing (either the model by adding or
removing columns/properties or directly the dbml file) is the only way
it works. Pretty sad though. It makes the whole dbml thing not much
better then any external O/R Mapper tool.

Kind regards. Matthias
 
Hi Frans,

thanks again for your feedback. I think we can agree on the point that
without any sync-capabilities the dbml thing is pretty useless. You
should hit the market with your templates :)

Kind regards. Matthias
 
Matthias said:
Hi Frans,

thanks again for your feedback. I think we can agree on the point that
without any sync-capabilities the dbml thing is pretty useless. You
should hit the market with your templates :)

I've spend most of the day working on them, and they're done for 99%
:) Just a small glitch in 1:1 relations in the class files, and we're
good to go :)

We hope to release them tomorrow (wednesday) in beta

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
thanks for your reply. is there a workaround? i mean, things change
I don't know whether this view will be popular, but my opinion is that
the current LINQ-to-SQL offering is good for rapid prototyping, and
for dipping a toe in the LINQ pond - R&D, etc. Maybe for "write once"
applets...

For production work on a moderate size system (i.e. where we
reasonably expect it to evolve over time), I'm waiting for Entity
Framework, which has better tooling, more flexibility (conceptual/
storage/mapping etc), and open provider support.

So yes; I agree with what you are saying (re LINQ-to-SQL), but I'm not
particularly concerned by it... if EF has the same gap, it would be a
bigger issue; I will try to find some time to fire up by beta machine
to investigate...
But I'm genuinely glad to see that Frans has spotted an opportunity to
innovate. Good luck to you, Frans! It'll certainly be yet another
selling point for LLBLGen.

Marc
 
hi frans,

i wish you the best of luck for llblgen. eventhough i won't profit from
it since i can't afford to buy a licence ;)

Kind regards. Matthias
 
Hi Marc,

We're currently working on a pretty large system. We are porting a
classic asp app (~200 pages plus a couple of windows services) piece by
piece to asp.net since we are a small dev-team and changes to the
system can be overseen, we'll go for the DBML thing since it seems to
fit our needs (except the missing sync functionality).

I'll certainly google for the Entity Framework you've mentioned ;)

Kind regards. Matthias
 
It'll be out in SP1... or at least, the ADO.NET team say "SP1" (.NET
3.5 SP1 and VS2008 SP 1), but Mike Taulty (at the MSDN roadshow on
Monday) officially couldn't call it SP1... but you get the idea...

http://blogs.msdn.com/adonet/
 
I finally got around to looking at my beta machine... EF does indeed
have an "Update Model from Database..." option, which looks at the
storage layer [EF's view of the database schema], and allows you to
add new items, remove deprecated items, and update existing. This
doesn't automatically update the conceptual layer [EF's class schema]
or the mapping layer [EF's tie between the two], but a quick glance at
the mapping panel quickly shows which storage properties don't have
corresponding conceptual properties. It is then trivial to add a
scalar property to the conceptual layer, and use the mapping layer to
tie it all together.

Of course, if you have a simple model and you just want to do a 1:1
mapping, you could just remove and re-add the table ;-p

In some simple tests (adding columns, etc) it seemed to work fine.

Marc
 
Matthias said:
hi frans,

i wish you the best of luck for llblgen. eventhough i won't profit
from it since i can't afford to buy a licence ;)

Thanks :)

Perhaps your employer is nice enough? ;)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top