views:

133

answers:

1

I've done a big mistake, now I have to find a solution. It was my first project working with fluent nhibernate, I mapped an object this way :

public PosteCandidateMap()
    {
        Id(x => x.Id);
        Map(x => x.Candidate);
        Map(x => x.Status);
        Map(x => x.Poste);
        Map(x => x.MatchPossibility);
        Map(x => x.ModificationDate);
    }

So the whole Poste object is in the database but I would have need only the PosteId. Now I got to find all Candidates for one Poste so when I look in my repository I have :

return GetAll().Where(x => x.Poste.Id == id).ToList();

But this is very slow since it loads all the items, we now have more than 1500 items in the table, at first to project was not supposed to be that big (not a big paycheck either). Now I'm trying to do this with criterion ou Linq but it's not working since my Poste is in a BLOB.

Is there anyway I can change this easyly?

Thanks a lot for the help!

A: 

Ok so what I've done is to create a new Object/table/repository, did a little foreach of my old data, parse it in the new object witch contains only the Ids, save it to the BD than changed all my oldReposotory to my new repository and jobs done!

Hope it helps!

VinnyG