开发者

how access database in wcf service in asp.net

I am making project in asp.net mvc3 and I have make a wcf webservice. I have to access database in wcf webservice. How i access controller class 开发者_如何学运维in wcf service method. if any other way to use then suggest me.


Why to you want to access the controller? That doesn't make any sense. Otherwise ASP.NET MVC & Web Services might help.


Hi instead of using Web Service you can use Web API. You can add web api by adding Web API Controller (v2 is good) and then you will see many auto implemented methods are there like get, post etc.

You can implement your code in those method or can built your own method. also if you want to give your custom url pattern to your methods then also you can do it by providing route config above the method.

And you can use your model classes in this webapi directly, so that you can save data into database.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜