linq to sql datasource on a class library solution RRS feed

  • Question

  • User1823571678 posted


    Is it possible to make a class library that contains a linq to sql datasource which can then be used to populate say a dropdownlist control in two different web application on the same solution/project?

    I  am planning have two websites which is part of a solution to use the same content like country to populate a dropdownlist control on their respective appliction. Although these sites may vary from its development. Just a though from this http://www.asp.net/general/videos/how-do-i-extend-and-customize-an-aspnet-server-control-for-a-specific-purpose which saw two sites sharing one class that contains a dropdown control.

    Any ideas from you guys, please point me to the right direction. Thank you!



    Wednesday, April 27, 2011 8:50 PM


  • User1182340765 posted

    Yes of course you can. It's kinda like a service-based N-tier system. You write a few classes in a library project as the repository to organize and provide data to upper level applications which are your websites. Then in your websites, you only need to access your custom libarary to obtain data without knowing how data is stored in a database.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 27, 2011 10:24 PM