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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:28:41+00:00 2026-06-11T05:28:41+00:00

We have create screens with duplicate option for each object. For ex: While creating

  • 0

We have create screens with duplicate option for each object. For ex: While creating new Customer along with details, user can chose existing customer to copy groups associated from existing to new user. So I would like to know how to assign properties of new customer for 1:n and m:n scenario.

  1. For “Customer” and “CustomerGroups”. Will the below approach work fine?

    Customer existing = repo<Customer>(id);
    
    Customer newCust = new Customer();
    for(var group in existing.Groups)
    newCust.CustomerGroups.Add(new CustomerGroup(){ **AllpropertiesexceptID**, **Customer=newCust** } );
    
  2. For Order and OrderItems, since its m:n relationship, just attaching existing items with new order.

    Orders existing = repo(id);
    Order newOrder = new Order();
    for(var item in existing.Items)
    newOrder.Items.Add(item);

Is it required to do Session.Evict for the existing Order or Customer for performing these operations.

  • 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-06-11T05:28:43+00:00Added an answer on June 11, 2026 at 5:28 am

    You might be thinking too much. 🙂 Just go ahead and create separate lookalike objects, pretending NHibernate isn’t even there. As long as the new instances have different (unset) identity properties, NHibernate won’t even realize they are “copies”.

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

Sidebar

Related Questions

Hopefully this will make sense. I have a page where an user can create
I have a class which reads an XML file to create several screens in
Possible Duplicate: Create Browser-Bookmark from app I have tried to create a bookmark for
I have create and edit screens for a entity. They only differ by one
Possible Duplicate: Create a UIViewController that contain a UIViewController I have a parent view
I'm helping a friend create an android app that will have screens with lists
I am configuring Jira for bug reporting, I have customised the create/edit/view screens for
I have to create now a multi-screen Silverlight 4 RIA application with MVVM. Each
I want to allow the user to create custom screens dynamically by selecting from
I have a few full screen png's where I want to create regions on

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.