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
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.
Hi Alessandro,
Thanks for contacting us.
>>
I read the Issue CQ22273 and I gave a look to the attached project but I didn't completely understand your code.
<<
The XpoSiteId is a helper persistent class that generates a GUID that corresponds to the user friend prefix (for instance qq in this sample). This GUID is used by the XpoSequencer to determine the number of objects with this prefix, to generate the next value.
If you run this sample project several times, you will notice that values produced by the XpoSiteId.GetNextSitedValue(seq) will be unique. Did this help you?
Then I suggest you check the following help topic: Initialize a Property After Creating an Object.
Feel free to ask questions in case of further difficulty.
Thanks,
Dennis
Hi Dennis,
Thank you very much for yor reply.
I included the two classes in my project and overriding the Order Class's method AfterConstruction() I get a sequential OrderNumber.
Anyway I still have some questions.
Best regards,
Alessandro
Hi Alessandro,
Thank you for the update.
Please let me know in case of any further difficulty.
Thanks,
Dennis
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
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
Perfect! Now everything is clear …
Thanks,
Alessandro