Apologies if this is too basic, have just started picking up .net 2.0 from 1.1 and am really confused with this error i'm getting, search has helped none and I'm not familiar enough with the framework to make sense of the error. NHibernate is working though as up until this point all was working perfectly.
I suspect this is an error with how i've slapped the code together or some inconsistency with using #develop instead of visual studio. All the same if anyone can help out at all it'd be very much appreciated.
Here is the code I'm using (as ripped from the quickstart guide)
Code:
Configuration cfg = new Configuration();
cfg.AddAssembly("testConsoleApplication");
ISessionFactory factory = cfg.BuildSessionFactory();
ISession session = factory.OpenSession();
ITransaction transaction = session.BeginTransaction();
User newUser = new User();
newUser.Id = "joe_cool";
newUser.UserName = "Joseph Cool";
newUser.Password = "abc123";
newUser.EmailAddress = "joe@cool.com";
newUser.LastLogon = DateTime.Now;
// Tell NHibernate that this object should be saved
session.Save(newUser);
// commit all of the changes to the DB and close the ISession
transaction.Commit();
session.Close();
Console.WriteLine("User added");
// open another session to retrieve the just inserted user
session = factory.OpenSession();
User joeCool = (User)session.Load(typeof(User), "joe_cool");
Console.WriteLine("User retrieved");
// set Joe Cool's Last Login property
joeCool.LastLogon = DateTime.Now;
// flush the changes from the Session to the Database
session.Flush();
Console.WriteLine("User updated");
// ****** all works fine up until here...
IList userList = session.CreateCriteria(typeof(User)).List();
foreach(User user in userList)
{
Console.WriteLine(user.Id + " last logged in at " + user.LastLogon);
}
These are the build errors i'm receiving:
Quote:
Build started.
Compiling testConsoleApplication
C:\Documents and Settings\Administrator\My Documents\Projects\testConsoleApplication\Main.cs(52,5) : error CS0305: Using the generic type 'System.Collections.Generic.IList<T>' requires '1' type arguments
C:\Documents and Settings\Administrator\My Documents\Projects\testConsoleApplication\Main.cs(53,5) : error CS1579: foreach statement cannot operate on variables of type 'IList' because 'IList' does not contain a public definition for 'GetEnumerator'
Build failed.
Thanks for any suggestions