Re: Design help.

Tech-Archive recommends: Speed Up your PC by fixing your registry



Thank you, I'm not skilled enough to understand though.

"Claus Konrad [MCSD]" <ClausKonradMCSD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0E1035FE-D4CF-41A3-8311-92D8C3458D1F@xxxxxxxxxxxxxxxx
You are on the correct path!
The better design approach is to declare your interfaces first.

1) Declare interfaces
2) Implement this interface in your classes (C# class).
3) Implemtent the webservices classes from the same interface
4) In the WS, authenticate and authorize access to the business logic
implemented in your "true" classes (step 2).

Why?
Well - first of all it forces you to take a contract-first approach. Next it
allows you to call the logic from another "client" than the webservice that
exposes the methods. Second it de-couples the businss from the fact that it
is exposed as a webservices; not really a businnss entiity, is it?

Example:

public interfaces IOrder
{
string GetSomething(arguments...);
}

public class Order : IOrder
{
//..
}

[WebService]
public class OrderService : WebService, IOrder
{

[WebMethod]
public string GetSomething((arguments..)
{
//authorize
//if not allowed access - throw UnAuthorizedAccessException!

//instantiate businnss logic

//return data
}

}

--
rgds.
/Claus Konrad
MCSD.NET (C#)


"John Sitka" wrote:

Hi, sorry for a crosspost but that other news group was showing last post was a
week ago so I guess it dosen't see much use...

I'm about to start a solution and I'm curious about the approach of a webservices project.
Should the objects be represented in classes such as...

public class Orders (ie Orders.cs) within a project
and then have the service be in a class like OrdersService.asmx
public class OrdersService : System.Web.Services.WebService
and this class contain only [WebMethod] 's

I guess another another way to ask the same question is..
Would it be less desireable if a class inheriting System.Web.Services.WebService
contain methods that are not [Web Method]







.



Relevant Pages

  • RE: Design help.
    ... The better design approach is to declare your interfaces first. ... Implemtent the webservices classes from the same interface ... public class OrderService: WebService, IOrder ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Better architecture for cross-platform project
    ... Actually I've already put all non-UI functions in a shared CF project, ... and fortunately they don't use webservices so that works great. ... then implementing those interfaces in concrete UI ... > would simply be for a UI that leverages the shared DLL. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Cant find Namespace
    ... Public Class Class1 ... There are about 6 other classes in Assemby2 that can't be found. ... Sub Save ... None of the other classes or interfaces I have will show up in the listing. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Clashing Interface methods
    ... I am trying to write my own queue, ... public class HashQueue ... extends Hashtable ... This combination beings in interfaces Collection, Map, Dictionary and ...
    (comp.lang.java.programmer)
  • Re: Generics and casting
    ... I added some interfaces but still the same casting problem. ... Unable to cast object of type 'BusinessCollection`1' to ... public class ContactPerson: BusinessObject, IBusinessObject ...
    (microsoft.public.dotnet.languages.csharp)