views:

354

answers:

3

I just recently started a new personal project, with a goal of having it able to scale from the start.

I got a suggestion for the structure, to create something like this:

<solution>
|-- project.client.sql.queries
|-- project.admin.sql.queries
|-- project.client.business.logic
|-- project.admin.business.logic
|-- project.client.web.ui (include references of the business logic + sql queries projects )
|-- project.admin.web.ui

This way, I would have everything structured and easy to follow for future expansion. My problem resides in the fact that I want to use only SQL express to start, and maybe move on to SQL server later when necessary.

So if I add the .mdf file into the app_code of the client side and create a .dbml (the linq structure file) how can I use linq into the sql querie ? I don't have access to the ConfigurationManager of the web.ui project. Do I have to include a reference into the sql queries project just as I did for the web.ui ? Othewise linq doesn't seem to work properly.

I'm looking mostly for the best practices, since I've been told that code behind should not include any business logic or sql queries - they should have their own class libraries.

+5  A: 

Here is the best advice anyone can ever give you at this point in time:

The crappy first version is infinitly better then the perfect version that doesnt exist.

I forget where I got that from, Ive seen that advice many places. It is 100% true.

Not sure how this answers the question in any way...
Dave Swersky
I sense a bit of "analysis paralysis" in his question.
Interesting but doesn't explain me really how to play with linq into a class library ;)
Erick
+1  A: 

Attach the database and create a linq to sql dbml file in your data project. When you initialise your dataservice class, pass in the connection string from web.config and set the connection string in your datacontext constructor. More info here: http://stackoverflow.com/questions/236412/connection-string-hell-in-net-linq-sql-asp-net

burnside
Nice great explanations there. I'll try to find some pieces to starts with!
Erick
A: 

Probably not what you initially asked, but consider the MVC model for your file layout and structure

http://www.asp.net/mvc/

It will make development a little more easier to maintain

Gautam
I know about the MVC I already use this model for my developpement in PHP. It's true it is really good, but it's still in beta and not really used in enterprises yet :-) why I'll be using webform is mostly to train myself.
Erick
Agreed. I was contemplating using the MVC 'addon' but realized if someone else opened the project they would be required to install the addon themselves.Until it becomes part of ASP.NET/Visual Studio, I probably won't use it unless the project really calls for it.
Gautam