Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var cfg = new Configuration();
            cfg.Configure();
            cfg.AddAssembly(typeof(Operators).Assembly);
            try
            {
                new SchemaExport(cfg).Execute(true, true, false);
            }
            catch (NHibernate.HibernateException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Operators op = new Operators() { Login="******", Password="******", Permissions="all" };
            IOperatorsRepository rep = new OperatorRepository();
            rep.Add(op);

            Operators dbOp = rep.getByLogin("Test1");
            if (dbOp.Password != op.Password)
            {
                throw new Exception("Passwords are not equal");
            }

            Console.ReadKey();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Обновить информацию об операторе
 /// </summary>
 /// <param name="op">экземпляр объекта Operators</param>
 public void Update(Operators op)
 {
     using (ISession session = NHibernateHelper.OpenSession())
     {
         using (ITransaction transacton = session.BeginTransaction())
         {
             session.Update(op);
             transacton.Commit();
         }
     }
 }