The best way to work with 200K data-record is not using NH.
If you need to upload 200K data in a winForm, please, use something else
than NH.
Thanks.

2010/1/25 ehnn <[email protected]>

> Hello all,
>
> I've just started using nhibernate and fluent nhiberate (so far about
> 24 hours). I've created the static session factory class (following
> many examples found on blogs etc) and have done the following in a
> winform's constructor to store 200,000 rows into a table (I need to do
> this to simulate the size of the datasets I will be dealing with):
>
>            int i = 0;
>            var s = SessionFactory.GetSession();
>            using (var tx = s.BeginTransaction())
>            {
>                while (i < 200000)
>                {
>                    var p = new Person { FullName = i.ToString() };
>                    s.Save(p);
>                    i++;
>                }
>                tx.Commit();
>            }
>
> This executes fine against the backend mssql, populating the person
> table with 200,000 rows. (Simple columns in table/entity, eg.
> FullName, Email, Address etc).
>
> If I now do this in another form constructor:
>
> var l = SessionFactory.GetSession().CreateCriteria<Person>().List();
>
> ... This takes about 20 seconds to get all the objects back. (I then
> bind this list to a bindingnavigator / bindingsource on a form.)
>
> Ideally, I want to be able to just get back a list of ID's, e.g....
> var q = session.CreateSQLQuery("SELECT Id FROM Person")
> ... bind this up to the bindingnavigator, and then get each entity as
> I move back / forward through the list so that the whole process is
> faster.
>
> What is the *best* or *recommended* way to go about this?
>
> Please excuse my ignorance if I am missing something obvious, I am new
> to nhibernate, however I have searching posts / blogs and do not know
> the answer.
>
> Thanks in advance for any help.
>
>
>    public class Person
>    {
>        public virtual int Id { get; protected set; }
>        public virtual string FullName { get; set; }
>        public virtual string KnownAs { get; set; }
>        public virtual string Title { get; set; }
>    }
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to