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 549865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:13:42+00:00 2026-05-13T11:13:42+00:00

this class is from http://wiki.fluentnhibernate.org/Getting_started it has some logic in it and I think

  • 0

this class is from http://wiki.fluentnhibernate.org/Getting_started
it has some logic in it and I think this violates the Single Responsibility Principle, how do you think, how would you resolve this ?

Another thing that bothers me is why in nhibernate always it is being used IList and not IEnumerable which has less functionality ?

public class Store
{
  public virtual int Id { get; private set; }
  public virtual string Name { get; set; }
  public virtual IList<Product> Products { get; set; }
  public virtual IList<Employee> Staff { get; set; }

  public Store()
  {
    Products = new List<Product>();
    Staff = new List<Employee>();
  }

  public virtual void AddProduct(Product product)
  {
    product.StoresStockedIn.Add(this);
    Products.Add(product);
  }

  public virtual void AddEmployee(Employee employee)
  {
    employee.Store = this;
    Staff.Add(employee);
  }
}
  • 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-13T11:13:42+00:00Added an answer on May 13, 2026 at 11:13 am

    In my opinion this does not violate the SRP principle. And, as Paco mentioned, it is still a POCO class. POCO does not mean that the object should only contain data.

    I would, as you mention, however change from IList<> to IEnumerable<> on my collections and make the setters private (for the collections). That is not a problem for nhibernate to handle. Using those “add” methods is in my opinion the preferred way of handling the collections on your model (blog post about that).

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

Sidebar

Related Questions

Using the Generator class from http://unpythonic.blogspot.com/2007/08/using-threads-in-pygtk.html , the following code makes my program fail:
I would like to extend the Queue.PriorityQueue described here: http://docs.python.org/library/queue.html#Queue.PriorityQueue The queue will hold
I am using Codeigniter 1.7.2 and HMVC (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home). I have these files and they
I just started taking a class on C# .NET and have found it really
Gollum is A simple, Git-powered wiki with a sweet API and local frontend. It's
I have a class ConstData: class ConstData US_CITIES = ['miami', 'new york'] EUROPERN_CITIES =
I need to check whether a certain class extends or implements a particular interface.
I need to download a BMP with JavaScript and render it to the screen,
I'm trying to do a django-south migration to an existing application to add django-audit-log
Here is a Python postfix notation interpreter which utilizes a stack to evaluate the

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.