Question

I’m new to NHibernate.Search and i’ve ran into a problem I need a little help with.

I need to add a [DocumentId] attribute to my ID field, but the Id field is in the Entity class...I found some code on stackoverflow that done this inside my POCO:

[DocumentId]
public virtual int Id
{
    get { return base.Id; }
    protected set { base.Id = value; }
}

But when I run the UpdateModel() function in my controller, I get an exception:

Exception Details: System.Reflection.AmbiguousMatchException: Ambiguous match found.

I think the model binder is seeing 2 Id fields, however i’m not sure of the best way around this.

Paul

Was it helpful?

Solution

I'll answer my own question on this one after a tinkering around a little.

[DocumentId]
public override int Id
{
    get
    {
        return base.Id;
    }
    protected set { base.Id = value; }
}

Paul

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top