c# - WCF design pattern for website -


i doing first proper technical design solution replace 1 of our existing solutions. @ present have variety of websites nominally same thing. 3 or 4 of them use classic asp , have never been updated far know meaning data return is, @ best flawed.

the application used majority of them sharepoint web part, using asp.net (3.5) creates several input boxes , combo boxes dynamically depending on accessing it. of config stored in sharepoint list (including user name , password database access). when user clicks search button calls stored procedure, processes , returns data. stored procedure other primary reason rewrite, has been developed on years many developers , none of them have commented doing - can take 30s return few hundred records , lot of time doesn't return i'd expect sigh

so, i've been given green light rewrite , i've come solution in head think work. however, when writing down not convinced right way go, i'd appreciate more knowledge me giving once over. app consist of following:

website

the website extremely basic - creating input boxes based on url access , allowing them submit request.

when user clicks submit button request made using channelfactory pattern wcf layer.

the response processed , user either shown data requested or error.

communications (wcf layer)

we have 2 requirements, 1 internet , 1 intranet have decided use wshttp internet using transport-level security , other possible use protocol (perhaps net-tcp binding?)

this layer acts buffer between outside world , data, doesn't much. calls 1 or more methods in data layer next

when response comes in data layer, either data (good) or error (bad). wcf service either create datacontract object or faultcontract object , return website.

data layer

for data layer using linq sql establish connection database , process request coming wcf. intending data layer sit on database server, created own class library.

in data layer code attempt process request , return object wcf layer.

so thats it. trying make system secure can, making more maintainable don't need reinstall webpart every time make minor change. included wcf layer can make more resilient, business critical system.

i'd appreciate advice on going wrong, or general comments :)

this pretty massive topic, i'd couple of comments:

  1. use asp.net mvc website
  2. separate concerns , use ioc such unity modularize problem
  3. try using built in authenticationservice features provided in framework
  4. interface out client proxy in website can hot-swap , mock test it.
  5. use entity framework instead of linq sql (just personal preference here)
  6. ensure make intranet wcf service use nettcp , use windows authentication
  7. try using formsauthentication public wcf service reduce burden of security needs. may want put in custom message interceptor set principal of thread.
  8. provide interface variants of of message types iorder, icustomer, iwhatever , keep boundaries discreet maximum modularity.

anyway, thats ten-pence worth , above has worked me!


Comments