sebastienros/yessql

Request to support dynamic index type

Opened this issue · 2 comments

hyzx86 commented

for example, in the following code, I want for to support the base class and then return the object of the actual type in the Map

    public class CarIndex : MapIndex
    {
        public string Name { get; set; }
        public Categories Category { get; set; }
    }

    public class CarIndexProvider : IndexProvider<Car>
    {
        public override void Describe(DescribeContext<Car> context)
        {
            context
            .For<MapIndex>()
                .Map(c => new CarIndex
                {
                    Name = c.Name,
                    Category = c.Category,
                });
        }
    }

I am trying to use reflection implementation. It looks a bit complicated and difficult to understand. It would be much better if Yessql could support For(Type t)

image

Maybe it has been supported at present, but I don't know how to use it yet.

relate : #525