Unknown entity class: NHibernate.Examples.QuickStart.User

xml Pakistan
  • 13 years ago

    It is users.sql :

     

    use NHibernate

    go

     

    CREATE TABLE users (

      LogonID nvarchar(20) NOT NULL default '0',

      Name nvarchar(40) default NULL,

      Password nvarchar(20) default NULL,

      EmailAddress nvarchar(40) default NULL,

      LastLogon datetime default NULL,

      PRIMARY KEY  (LogonID)

    )

    go

     

     

    It is users.cs :

     

    using System;

    using System.Collections.Generic;

    using System.Text;

    using NHibernate;

    using NHibernate.Cfg;

     

     

    namespace NHibernate.Examples.QuickStart

    {

        public class User

        {

            private string id;

            private string userName;

            private string password;

     

            private string emailAddress;

            private DateTime lastLogon;

     

     

            public User()

            {

            }

     

            public string Id

            {

                get { return id; }

                set { id = value; }

            }

     

            public string UserName

            {

                get { return userName; }

                set { userName = value; }

            }

     

            public string Password

            {

                get { return password; }

                set { password = value; }

            }

     

            public string EmailAddress

            {

                get { return emailAddress; }

                set { emailAddress = value; }

            }

     

            public DateTime LastLogon

            {

                get { return lastLogon; }

                set { lastLogon = value; }

            }

     

        }

     

        //interface ISession

        //{

        //    void save(users newUser);

     

        //    void Save(users newUser);

        //}

     

    }

     

     

    It is User.hbm.xml :

     

    using System;

    using System.Collections.Generic;

    using System.Text;

    using NHibernate;

    using NHibernate.Cfg;

     

     

    namespace NHibernate.Examples.QuickStart

    {

        public class User

        {

            private string id;

            private string userName;

            private string password;

     

            private string emailAddress;

            private DateTime lastLogon;

     

     

            public User()

            {

            }

     

            public string Id

            {

                get { return id; }

                set { id = value; }

            }

     

            public string UserName

            {

                get { return userName; }

                set { userName = value; }

            }

     

            public string Password

            {

                get { return password; }

                set { password = value; }

            }

     

            public string EmailAddress

            {

                get { return emailAddress; }

                set { emailAddress = value; }

            }

     

            public DateTime LastLogon

            {

                get { return lastLogon; }

                set { lastLogon = value; }

            }

     

        }

     

        //interface ISession

        //{

        //    void save(users newUser);

     

        //    void Save(users newUser);

        //}

     

    }

     

    It is App.config :

     

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

         

          <configSections>

                <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

          </configSections>

         

          <nhibernate>

                <add key="hibernate.connection.provider"  value="NHibernate.Connection.DriverConnectionProvider" />

                <add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect" />

                <add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />

                <add key="hibernate.connection.connection_string" value="Data Source=dev2;Initial Catalog=NHibernate;User ID=sa;Password=buyagift;" />

          </nhibernate>

         

    </configuration>

     

     

    It is Programs.cs :

     

    using System;

    using System.Collections.Generic;

    using System.Windows.Forms;

     

    namespace NHibernate

    {

        static class Program

        {

            /// <summary>

            /// The main entry point for the application.

            /// </summary>

            [STAThread]

            static void Main()

            {

                Application.EnableVisualStyles();

                Application.SetCompatibleTextRenderingDefault(false);

              //  Application.Run(new NHibernate.Form1());

                Application.Run(new NHibernate.Examples.QuickStart.Form1());

               

            }

        }

    }

     

     

     

    This code generates following error:

     

    Unknown entity class: NHibernate.Examples.QuickStart.User

     

    Can anyone help me please?

    Thanks

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC. As potential programmers, they are mentally mutilated beyond hope of regeneration.” - E. W. Dijkstra