Best way to implement “ReOrderable Collection” and Persist it to database

前端 未结 6 781
执笔经年
执笔经年 2021-01-03 12:12

My domain object :

public class MyDomainObject
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public int DisplayOrder { get; set         


        
6条回答
  •  梦毁少年i
    2021-01-03 12:56

    I answered a previous/similar question about re-ordering here: How to design table that can be re-sequenced?

    This does a good job of resaving the Order with no gaps. Depending on the size the lists resaving the Order may be a perfectly viable option, for long lists Mark Byers' idea looks pretty good.

提交回复
热议问题