Stucture and getting it all together RRS feed

  • Question

  • User1725441281 posted


    I'm trying to build a website that has different "modules" such as addressbook, shop, contactform and such things. Usually I have an /admin where the user logins and create and edit things. A public site with mostly standard pages and some listings from the different "modules".

    How would you guys structure that?

    Would you compile each thing so it ends up in 1 DLL and then code against it? And is only the .dbml file needed to make that happen or do I need some other projecttype?

    Not sure if I make any sense in this post :)

    Monday, December 8, 2008 5:17 AM

All replies

  • User-1005219520 posted

    Do the modules all share the same DB?  You can go the web site (file) or web application route - but I strongly suggest you test early and often on IIS7 with Vista/SP1 or Win08.

    Monday, December 8, 2008 2:51 PM
  • User1564875471 posted

     I Think you need to have many dbml files , one for each module ,

    The dbml can be created in App_Code folder or in a separate class library , and if you want to use the dbml from another websites , you have to write them in a separate class library porject.

    Monday, December 8, 2008 3:01 PM
  • User1725441281 posted

    Ok, that seems like the way to go :)

    How would you pass in the connection string? I managed to create a classlibrary but it has app.config with the connectionstring.

    I added a Dynamic Data Site to test it out, but not sure how its best to connect from that thingy since its like:

    model.RegisterContext(typeof(ClassLibrary1.DatabaseDataContext), new ContextConfiguration() { ScaffoldAllTables = true });





    Tuesday, December 9, 2008 5:09 AM
  • User-330204900 posted

    You can register multiple model and with the same app and keep the page structure seperate via Routing see my article here:Dynamic Data – Registering Multiplw models

    Tuesday, December 9, 2008 6:45 AM
  • User-1005219520 posted

    The data model has two constructors - the default gets the connection string from web.config or app.config - you can also pass in the constructor explicitly as in the following code.

    string conStr = "Data Source=bing0;Initial Catalog=AdventureWorksLT2008;"
                          + "Persist Security Info=True;User ID=sa;Password=*(IU89iu;";

            model.RegisterContext(() => new DataClassesDataContext(conStr), new ContextConfiguration() {
                ScaffoldAllTables = true });


    Tuesday, December 9, 2008 1:39 PM
  • User-1005219520 posted

    I blogged explict construction string. See Explicit connection string for EF

    Tuesday, December 9, 2008 4:08 PM