예제 #1
0
        private const string ConnectionString = "server=localhost;user id=root;persistsecurityinfo=True;database=supervkappdb"; //

        #endregion Fields

        #region Methods

        static void Main(string[] args)
        {
            var nhibernatehelper = new NHibernateHelper(ConnectionString);
            var unitofwork = new UnitOfWork(nhibernatehelper.SessionFactory);

            //попробуем чонить добавить в бд

            var user = new UserDomain
            {
                //Id = "egorveidt", какого черта я сделал интовый айдишник, фаак !!! переделать
                FirstName = "Егор",
                LastName = "Пичугов",
                Age = 21,
                Male = true
            };
            var post = new PostDomain
            {
                Date = new DateTime(2016, 01, 07),
                Text = "test text exst",
            };

            post.AddSnapshot(new PostSnapshotDomain()
            {
                CountComments = 1,
                CountLikes = 10,
                CountReposts = 2,
                Date = new DateTime(2016, 01, 07)
            });

            user.AddPost(post);
            var userRepository = new Repository<UserDomain>(unitofwork.Session);
            userRepository.SaveOrUpdate(user);
            unitofwork.Commit();
        }
예제 #2
0
 protected internal virtual void SetPost(PostDomain post)
 {
     Post = post;
 }
예제 #3
0
 public virtual void AddPost(PostDomain post)
 {
     post.SequenceSnaphot = this;
     Posts.Add(post);
 }
예제 #4
0
 public virtual void AddPost(PostDomain post)
 {
     Posts.Add(post);
     //post.LoginUsers.Add(this);
 }
예제 #5
0
 public virtual void AddPost(PostDomain post)
 {
     post.Owner = this;
     Posts.Add(post);
 }
예제 #6
0
 public virtual void AddPost(PostDomain post)
 {
     post.Owner = this;
     Posts.Add(post);
 }
 public virtual void AddPost(PostDomain post)
 {
     post.SequenceSnaphot = this;
     Posts.Add(post);
 }
예제 #8
0
 protected internal virtual void SetPost(PostDomain post)
 {
     Post = post;
 }
예제 #9
0
 public virtual void AddPost(PostDomain post)
 {
     Posts.Add(post);
     //post.LoginUsers.Add(this);
 }