Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MVC - Entity (EDMX) - Questions on database connection 1

Status
Not open for further replies.

fletchsod

Programmer
Dec 16, 2002
181
Hi!

A few questions here...

1) In EDMX (model) designer, how to you change the database connection (different server, different password, etc.) after the model is already created.

2) Is there a way for EDMX (model) designer not to save database name, username and password to web.config?

3) ...

Thanks...
 
this isn't so much an asp.net or mvc question. it's a data modeling question. granted there isn't really a forum for specific MS development tools so this forum is as good as any.

1. I would assume EF builds the connection string using the connectionStrings node in the web/app config file. changing the context/connection string used by EF is just a matter of updating the config file. no code changes required.

2. why wouldn't you want to store the connection string in the config file? this is the best place to keep this information. you can encrypt the configuration file/sections if necessary. you wouldn't want to store this information in the code. It's not secure there. You may also be able to store this information in the registry. I think it's possible, but I don't know the specifics.

EF is built on top of ado.net. it's purpose is to abstract all the messy database stuff from your code. it's also going to take advantage of the existing abstractions in ado.net. it shouldn't make these abstractions more difficult to use.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks...

I'm seeing the picture now...

1) The web.config is how EMDX designer use it to update database model (The connection string is saved in web.config). Also, there are three entitie objects (if you look in EDMX source code). The default one (without parameters) use the web.config. The 2nd one will accept connection string as parameter argument. The 3rd one will accept EntityClient stuff as parameter arguement.

I can use the new connection string to override the default setting.

2) That's alright. I found I can save it without a password for now. Encryption, um, interesting idea. It wouldn't hurt.

Thanks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top