Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6680123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:26:18+00:00 2026-05-26T04:26:18+00:00

In my mvc3 application, I have things setup like: 1. repositories for each entity

  • 0

In my mvc3 application, I have things setup like:

1. repositories for each entity
2. service class for each entity that wraps the bare nhibernate db calls with business logic

Now for example, a class that registers a user, I want the service class to return something more than a boolean or user object if the user can register successfully.

Is this good practise?

Reason being, a person may fail to register correctly for reasons like:

1. duplicate email address in the system
2. duplicate username
3. etc.

So my method may look like:

public User Register(User newUser)
{
   // check for a user with the same email
   // check for a user with the same username

   // validation checks etc.

   return user;
}

I am thinking of creating a UserRegistrationResponse object so I can return back a much richer return value.

So something like:

public UserRegistrationResponse Register(User user)
{
  ..

  return userRegistrationResponse;
}

This way I can return back a user frienly response I can propogate to the UI layer, and still get the user object and other information etc.

Comments on this approach?

I guess the only other way would be to throw exceptions, but is that really a good idea? The idea is for me to able to re-use these service classes, like say in a Restful service layer I will need in the future.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:26:18+00:00Added an answer on May 26, 2026 at 4:26 am

    This is very common. 10 out of 10 WCF projects I’ve worked on in the past 3 years used this pattern. This includes legacy projects at three different companies, green field development and mvc/webforms projects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC3 application and I would like to give the users the
I have Ninject working nicely in an ASP.NET MVC3 web application. I'd like to
We have an existing MVC application that we're building using TeamCity and things were
We have a MVC3 application that we have created many small actions and views
If I had a model like this in my MVC3 application: public class Person
In my ASP.NET MVC3 application I have the following method that use EF entities
I have an ASP MVC3 application that has several HttpPost ActionResult methods. During a
I have to develop an ASP.NET MVC3 application in C# and Razor that has
I am working on an MVC3 web application. One of my requirements is that
I have a fairly large MVC3 application, of which I have developed a small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.