468,257 Members | 1,437 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

Refresh Linq Data Entities in the Model

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
--

Jun 27 '08 #1
13 2996
Matthias S. wrote:
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#)
------------------------------------------------------------------------
Jun 27 '08 #2
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
--

Frans Bouma [C# MVP] wrote:
Matthias S. wrote:
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
Jun 27 '08 #3
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
Jun 27 '08 #4
Matthias S. wrote:
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#)
------------------------------------------------------------------------
Jun 27 '08 #5
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
--

Marc Gravell wrote:
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
Jun 27 '08 #6
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
--

Frans Bouma [C# MVP] wrote:
Matthias S. wrote:
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
Jun 27 '08 #7
Matthias S. wrote:
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#)
------------------------------------------------------------------------
Jun 27 '08 #8
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.
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
Jun 27 '08 #9
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
--

Frans Bouma [C# MVP] wrote:
Matthias S. wrote:
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
Jun 27 '08 #10
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
--

Marc Gravell wrote:
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.

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
Jun 27 '08 #11
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/
Jun 27 '08 #12
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
Jun 27 '08 #13
Matthias S. wrote:
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#)
------------------------------------------------------------------------
Jun 27 '08 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Redd | last post: by
3 posts views Thread by Simon Harvey | last post: by
reply views Thread by Marshal | last post: by
7 posts views Thread by Ronald S. Cook | last post: by
4 posts views Thread by =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post: by
1 post views Thread by Andy B | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.