Ticket Q130688
Visible to All Users

CQ22273 - ( Auto generated sequence numbers ) - how does this work?

created 17 years ago

Is there a facility or best practice for generating ascending human-readable sequence numbers for entities such as Order.OrderNumber (i.e. each saved order gets the next available order number)?
I read the Issue CQ22273 and I gave a look to the attached project but I didn't completely understand your code.
If have a class like this:
public class Order: BaseObject {
    …
    [Indexed(Unique=true)]
    public string OrderNumber;
    …
}
How can I use the code in your example to give an auto generated value to the property OrderNumber?
Best regards,
Alessandro

Show previous comments (3)
AP AP
Alessandro Pillon 17 years ago

    Hi Dennis,
    Excuse my ignorance.
    I thought that the attribute [Key(false)] meant "Not key". Now I checked that it means "key not autogenerated".
    I found also the tables in the schema: again for my ignorance the program was generating the tables in separated mdb file.
    Now I'm using the right datalayer and the program is generating the tables ine the right schema.
    So the property Zero is the key of the table XpoSiteId. That means that the table contains only one record with a unique GUID for the field SiteId.
    I'm sorry but I don't understand the usefulness of appending this GUID to the user friend prefix .
    If I call directly XpoSequencer.GetNextValue(CurrentDataLayer, "UserPrefix") (instead of XpoSequencer.GetNextValue(CurrentDataLayer, "UserPrefix@Guid") ) I get anyway an incrmental value.
    Thank you again for you kindness and I'm sorry also for my bad english.
    Alessandro

    Dennis Garavsky (DevExpress) 17 years ago

      Hi Alessandro,
      I am very glad to hear that you can use these helper classes in your application and it works.
      >>
      I'm sorry but I don't understand the usefulness of appending this GUID to the user friend prefix.
      I'm sorry but I don't understand the usefulness of appending this GUID to the user friend prefix .
      If I call directly XpoSequencer.GetNextValue(CurrentDataLayer, "UserPrefix") (instead of XpoSequencer.GetNextValue(CurrentDataLayer, "UserPrefix@Guid") ) I get anyway an incremental value.
      <<
      The approach used in this example was borrowed from the code of our internal applications, which are used in databases located on many servers. So, an additional unique identifier is required to work correctly in this environment.
      Please let me know in case of any difficulty.
      Thanks,
      Dennis

      AP AP
      Alessandro Pillon 17 years ago

        Perfect! Now everything is clear …
        Thanks,
        Alessandro

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.