开发者

Linq to sql in DNN compiled module

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜