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(); } }
//[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); }
public Comment(Post post, User author, string content) : base() { this.post = post; this.author = author; this.content = content; }
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(); } }
public void PublishComment(Comment comment, Post post) { throw new NotImplementedException(); }