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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:21:28+00:00 2026-05-15T21:21:28+00:00

Just a quickie … I have the following ID generator strategy for one of

  • 0

Just a quickie … I have the following ID generator strategy for one of my mapped classes:

<id name="UID" type="System.Guid">
    <column name ="UID" sql-type ="uniqueidentifier" />
    <generator class="guid.comb" />
</id>

The entity in question is involved in synchronisation / merging behaviours from which it is necessary to have a globally unique identifier.

When an entity is created on a client application for the first time, it’s UID property gets assigned so that it is the same value of the equivilent entity on the server.

However the above ID generator strategy overwrites any value provided for new/transient entities.

Whats the fix? Will I have to remove the generator strategy and assign my own GUIDs? Or is the generator strategy configurable to only generate a guid.comb when required?

  • 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-15T21:21:28+00:00Added an answer on May 15, 2026 at 9:21 pm

    I think you can accomplish this by making UID a private field and controlling access through the property.

    public class MyClass
    {
        private Guid _uid;
    
        protected MyClass() { // parameterless ctor for NH }
    
        public MyClass(Guid uid) { _uid = uid; // assign on creation }
    
        public Guid Uid
        {
            get { return _uid; }
            private set { // do nothing or compare _uid to Guid.Empty and set }
        }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quickie before the weekend rolls in... I have a Method with the
A quickie just to get peace of mind: Considering the following final String str
Just a quickie, i have an xml resource in res/values/integers.xml <?xml version=1.0 encoding=utf-8?> <resources>
A quickie, and hopefully an easy one. I'm following the docs at http://docs.djangoproject.com/en/dev/topics/auth/ to
Just a quickie, I have a date in my database where a subscription to
Just checking my JS and I have an error, but I cannot see where.
Just a knowledge question which I would like to ask: For example, I have
Just a quickie.. If I set on an alert document.title to ALERT per say.
A quickie, is it possible to have an image darkened using javascript or something?
Just a quickie.. How to derive the unixtime of nearest March or June? If

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.