Inheritance: System.Entity
        public void CanSaveSampleDomainItem()
        {
            var database =
                AutoDatabase<Base>.Create(
                    PersistenceConfigurer.SqlExpress("localhost", "BibliopediaTest"), true);

            using (var session = database.SessionFactory.OpenSession())
            {
                var longString = new StringBuilder(16384);
                while (longString.Length < longString.Capacity) longString.Append("_");
                var concrete = new Concrete{Value = longString.ToString()};
                var referrer = new Referrer();
                referrer.Items.Add(concrete);

                using (var trans = session.BeginTransaction())
                {
                    session.Save(referrer);
                    trans.Commit();
                }

            }
        }
Ejemplo n.º 2
0
        public void CanSaveSampleDomainItem()
        {
            var database =
                 AutoDatabase<Base>.Create(
                    PersistenceConfigurer.FileBasedTempDb("d:/Test"), true);

            using (var session = database.SessionFactory.OpenSession())
            {
                var concrete0 = new Concrete { Value = "A" };
                var concrete1 = new Concrete { Value = "B" };
                var referrer = new Referrer();
                referrer.Items.Add(concrete0);
                referrer.Items.Add(concrete1);

                using (var trans = session.BeginTransaction())
                {
                    session.Save(referrer);
                    trans.Commit();
                }

            }
        }