Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2006

Tip: Looking for answers? Try searching our database.

membership/role providers - transactions and integrity!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mehdi - 30 Nov 2006 12:10 GMT
Hi folks,
I got a general question that I cannot find the answer for. Consider a
3-tier application architecture with a Web Service handling the
business layer (BL) logic. The BL provides the client the facility to
create/update/delete or query any given Employee account within the
system. Each employee has got a username/password pair that's supposed
to be stored in the *aspnetdb* database using the Membership API. The
question is that how a client is supposed to create an employee account
with one web method, and create a new user name with another web
method, *transactionally* under a *stateless* web service???

[WebMethod] void CreateEmployee(Employee employee) { }

[WebMethod] void CreateUser(string username, string password) {}

How am I supposed to keep the integrity of the system? Maybe, you
suggest the following WebMethod instead of those two:

void CreateEmployee(Employee employee, string username, string
password) {}

However, this introduces a new bunch of problems under the
UpdateEmployee/DeleteEmployee and the like methods.

What should be done to handle the issue rationally?

Thank you for your time,
Mehdi
John Saunders - 02 Dec 2006 03:10 GMT
> Hi folks,
> I got a general question that I cannot find the answer for. Consider a
> 3-tier application architecture with a Web Service handling the
> business layer (BL) logic.

Why is that a good idea? Below, you describe why it is not a good idea. Is
there something that overrides the bad?

John
mehdi - 02 Dec 2006 08:44 GMT
I don't get your point! Would you please describe more?

> > Hi folks,
> > I got a general question that I cannot find the answer for. Consider a
[quoted text clipped - 5 lines]
>
> John
John Saunders - 02 Dec 2006 19:09 GMT
>I don't get your point! Would you please describe more?

Why do you feel it is a good idea to expose your business logic functions as
web services on a one-to-one basis? You described several reasons why it is
_not_ a good idea to do so. I was wondering if you had any reason to believe
it was a good thing to do.

This is a very oblique way of saying that you should consider more of a
Service-Oriented Architecture. Instead of exposing fine-grained operations
like "create user" and "create employee", expose operations which embody
larger operations, like "Provision New User". This might include the "create
user" and "create employee" functions, and could perform those two functions
within a transaction.

Now, I also dabble in UML. Several times, I have been able to find the
service boundary by working with use cases and UML Use Case Diagrams. I have
found it to be a good rule of thumb to find the "top-level" use cases,  then
to expose them as services. Now, use cases are meant to be descriptions of
pieces of useful behavior, from the point of view of one or more "actors".
"create user" and "create employee" might be considered use cases, but
they're not "top-level' use cases. No actor would use "create user" and then
feel that they'd really accomplished something. On the other hand, some
actor might have "provision new user" as something they needed to
accomplish, so that's the function you should expose.

So far in my web services career, this approach has also had the benefit of
showing me where transaction boundaries should be. An actor would expect
"provision new user" to be an atomic operation, so that's a natural
transaction boundary. The fact that "create user" and "create employee" are
business logic functions which can be transactional is irrelevant to what
the actor is trying to accomplish. If I were implementing using COM+, for
example, I might set "provision new user" as "Requires New Transaction", but
the two "creates" as "Requires Transaction".

John
mehdi - 03 Dec 2006 08:19 GMT
I do agree with your approach - no ifs and/or buts.

Thank you for your time,
Mehdi

> >I don't get your point! Would you please describe more?
>
[quoted text clipped - 31 lines]
>
> John

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.