示例#1
0
        public void Test_Add_Item()
        {
            using (IRepositoryContext ctx = ServiceLocator.Instance.GetService<IRepositoryContext>("DapperRepositoryContext"))
            {
                IPostRepository postRep = (IPostRepository)ctx.GetRepository<Post>();

                Post p = new Post();
                p.AuthorId = 1000;
                p.TopicId = 1000;
                p.Content = "Test Add_Post" + Utils.GetUniqueIdentifier(5);
                p.Status = new PostStatus();
                p.Status.InternalId = Guid.NewGuid();
                p.Status.InternalStatus = "NEW";

                postRep.Add(p);
               
                ctx.Commit();
            }
        }
示例#2
0
文件: Comment.cs 项目: tu226/Eagle
        //[Reference()]
        //public Post Post
        //{
        //    get
        //    {
        //        return this.post;
        //    }
        //    set
        //    {
        //        this.post = value;
        //    }
        //}

        public static Comment Create(Post post, User author, string content) 
        {
            return new Comment(post, author, content);
        }
示例#3
0
文件: Comment.cs 项目: tu226/Eagle
 public Comment(Post post, User author, string content) : base()
 {
     this.post = post;
     this.author = author;
     this.content = content;
 }
示例#4
0
        public void Test_CRUD_Item()
        {
            using (IRepositoryContext ctx = ServiceLocator.Instance.GetService<IRepositoryContext>("DapperRepositoryContext"))
            {
                IPostRepository postRep = (IPostRepository)ctx.GetRepository<Post>();

                Post p1 = new Post();
                p1.AuthorId = 1000;
                p1.TopicId = 1000;
                p1.Content = "Test CRUD Add Item" + Utils.GetUniqueIdentifier(5);
                p1.Status = new PostStatus();
                p1.Status.InternalId = Guid.NewGuid();
                p1.Status.InternalStatus = "NEW";
                postRep.Add(p1);
                
                Post p2 = postRep.FindByKey(1017);
                p2.Content = "Test CRUD Update Item" + Utils.GetUniqueIdentifier(5);
                p2.Status.InternalStatus = "MODIFIED";
                postRep.Update(p2);

                Post p3 = postRep.FindByKey(1038);
                postRep.Delete(p3);

                ctx.Commit();
            }
        }
示例#5
0
 public void PublishComment(Comment comment, Post post)
 {
     throw new NotImplementedException();
 }