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.
Asked
Active
Viewed 637 times
2 Answers
1
Why to you want to access the controller? That doesn't make any sense. Otherwise ASP.NET MVC & Web Services might help.
-
then how i access database i have to retrive and insert value in database. – chetan singhal Jun 18 '11 at 12:04
-
Just use the same model as for MVC. – 0x434D53 Jun 18 '11 at 12:09
0
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.

Harsh Vyas
- 316
- 4
- 13