views:

43

answers:

2

Hello,

I have question :-) How to map this class

[Serializable]
public class AgentSourceCounter
{
    private int agentId;
    private IDictionary<int, int> sourceCounters;

    protected AgentSourceCounter()
    {
    }

    public AgentSourceCounter(int agentId, Dictionary<int, int> sourceCounters)
    {
        this.agentId = agentId;
        this.sourceCounters = sourceCounters;
    }

    public virtual int AgentId
    {
        get { return agentId; }
        protected set { agentId = value; }
    }

    public virtual IDictionary<int, int> SourceCounters
    {
        get { return sourceCounters; }
        set { sourceCounters = value; }
    }
}

to this table: agentId int; sourceId int; hitsCounter int;

Thanks in advice, Victor

+1  A: 

you can make a .hbm file.

maybe the below link is suitable for you :

NHibernate Mapping

masoud ramezani
A: 

Thanks for answer but that example didn't solve my problem.

This table contains unique composite key agentId and sourceId and caintains such data

agentId sourceId hitCounters
   1           101             10
   1           102             10
   1           103             34
   2           102             23
... ... ...

and e.g. GetSourceCountersByAgentId(int agentId) should return an instance of a class above. How does look hbm file?

Thanks in advice, Victor

Victor

related questions