views:

22

answers:

1

I would like to create a linq to sql class library that I can reference in all of my custom modules for this project I am working on. Does anyone have any suggestion or examples that I may reference?
I have about 3-4 custom modules requirements that all will pull data from the same set of tables. I could implement this using the standard dataprovider model, however, I like a good challenge and I love working with linq.

A: 

I haven't developed any module with linq but following are my suggessions:

  • Create a class library project, and create .dbml there.

This way if you want only two custom modules to be delployed, it will just work fine. the only drawback will be, dll will have all the other classes not used in those modules.

  • Reference the library in your module, and in your modules SqlDataProvider create constructor of dataContext with passing connectionString in it. (There is already one to use)

This way, you are using same connection string that dnn is using and no problems!

Also there is a good sample on it here : http://adefwebserver.com/dotnetnukehelp/linqtutorial/

I hope this will help you.

lakhlaniprashant.blogspot.com