Wrox Programmer Forums
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 8th, 2014, 03:37 PM
Authorized User
 
Join Date: Oct 2012
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
Question Data Base for each User

Hi,
I have built up a fairly extensive application which contains about 30 screens and 11 tables. I have come to the point in its development where I need to associate each user with their own data contained in these tables. I read through Chapter 17 in "Beginning ASP.NET 4" where individual records in a certain file were associated with each user for editing. While I suppose I could follow this idea in my case, this seems like an awful lot of possibly error prone work. I was hoping there was some way in which the user's ID could be mapped to a unique connection string in the web.config table. I have not found any literature describing such an approach. Does anyone know if there is one or an equivalent "bulk" mapping?
Incidentally I use both SQL and LINQ methods to access the data.
 
Old October 8th, 2014, 04:43 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

it's very common to have a single database for all users, and then map that data to each user. Many "multi-tentant" systems are built that way.

If you do want to use a connection string per user, you can change the one being used at run time. How, depends on your data access strategy. For a SqlDataSource control you can set its ConnectionString property: See http://msdn.microsoft.com/en-us/libr...vs.110%29.aspx and http://www.youtube.com/watch?v=R5BQT1vo5sc and https://www.google.com/?gws_rd=ssl#q...n+time&spell=1

However, be aware of the overhead this solution brings. Each user now needs a user account and possible a license in SQL Server as well. I would prefer the multi-tenant solution.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
nick1248 (October 9th, 2014)
 
Old October 9th, 2014, 11:38 AM
Authorized User
 
Join Date: Oct 2012
Posts: 19
Thanks: 6
Thanked 0 Times in 0 Posts
Smile Many Thanks

Thank you Imar. I better roll up my sleeves!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Data base Format virus220 ASP.NET 2.0 Professional 0 August 10th, 2007 09:37 AM
Data base connectivity watashi C# 2005 8 July 18th, 2007 08:05 PM
Data warehousing Data Base. mail2bhagavan SQL Language 1 March 25th, 2007 11:31 PM
Transfering data from csv file to data base g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 2 May 16th, 2006 11:58 PM
Data Base Connection ashraf Javascript 4 November 27th, 2004 06:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.