Hey Martin,
I recently ran into a situation where I have a Comment BO that should show the comments in the order in which they where entered. I created an Int64 field in the BO and marked it using the [NonPersistent] attribute. Then set the field in SQL Server as an Identity with a seed of 1 and increment of 1. This seems to work well (the comments appear in the correct order when performing a Select from SQL Server query); however, the XAF listview for the Comment object returns '0' for the value - I guess because it is marked with the [NonPersistent] attribute.
I have set the Comments_ListView to sort descending so the most current comments are listed first, but since the field returns '0' for every record, it does not sort (of course). Is there a way to persist these comments in a way that preserves the order? I even tried it without the attribute and removed the setter, but it still returns '0' for the identity field. I thought about using the entered date and sorting that way, but what about comments entered the same day - only the dates are stored in the table, not date and time.
Did you ever figure out anything concerning this or find information somewhere that you can share? Anybody else have this requirement that can help?
Thanks,
Kelly.
- Abandonned - I just removed the int64 field that I had set as an identity field from the Comment BO. Too little documentation exists to try and figure out how to make it work. Instead, I am just writing DateTime.Now to the EntryDate field instead of DateTime.Today. Since SQL Server stores the time down to .001 seconds, I figure that should be enough to determine the order in which the comments are entered. But, I can see a need for a non-key identity field. I like to use GUID's for primary keys and INT identity fields to preserve an order. Kelly.