Skip to main content

Microsoft Silverlight

Answered Question cannot make a Dynamic ConnectionString using ria.RSS Feed

(0)

Wigen
Wigen

Member

Member

3 points

16 Posts

cannot make a Dynamic ConnectionString using ria.

The question i have is.. How do i make a dynamic connection string using RIA?

 I am able to change the context inside of ria and pass it a database name to connect to, this only works when getting the information, i cannot run "submitchanges" as it will look at the original context instead of the one i changed.

 Say i have a database of printers for 1 store that is called "printers"

then store 2 is "printers2"

without changing the webconfig how can i get ria to change connection strings?  we have a database that stores database names that is across all stores so that is how i would be able to know what the database name is i want to connect to.

 thanks!

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP
Answered Question

Re: cannot make a Dynamic ConnectionString using ria.

You would probably need to add some custom logic in your Update method to update the proper database based on the object being updated. This would need to happen in the service.

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

Wigen
Wigen

Member

Member

3 points

16 Posts

Re: Re: cannot make a Dynamic ConnectionString using ria.

How could i do that? i tried adding a parameter in the Update method and it gave me an error where i wasnt able to make it anything else than having 1 parameter.

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP

Re: Re: Re: cannot make a Dynamic ConnectionString using ria.

Can you post a sample of the update method that won't work?

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

Wigen
Wigen

Member

Member

3 points

16 Posts

Re: Re: Re: Re: cannot make a Dynamic ConnectionString using ria.

I understand now,  I made a new update method that got the item that is being updated and passed the connection string. then did a savechanges on the service and it worked. Thanks!

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities