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(); }
protected internal virtual void SetPost(PostDomain post) { Post = post; }
public virtual void AddPost(PostDomain post) { post.SequenceSnaphot = this; Posts.Add(post); }
public virtual void AddPost(PostDomain post) { Posts.Add(post); //post.LoginUsers.Add(this); }
public virtual void AddPost(PostDomain post) { post.Owner = this; Posts.Add(post); }