public void Nonlazy_collections_can_be_fetched_with_queries() { ActiveRecordStarter.Initialize(GetConfigSource(), typeof(SimpleBlog), typeof(SimplePost)); Recreate(); var blog = new SimpleBlog { Name = "Blog" }; var post = new SimplePost { Blog = blog, Title = "Post" }; blog.Save(); post.Save(); var query = new SimpleQuery <SimpleBlog>("from SimpleBlog b join fetch b.Posts"); using (new StatelessSessionScope()) { var result = query.Execute(); Assert.AreEqual(1, result.Length); Assert.AreEqual(1, result[0].Posts.Count); Assert.AreEqual("Post", result[0].Posts[0].Title); Assert.AreSame(result[0], result[0].Posts[0].Blog); } }
// [Fact] public void Benchmark() { var manual = new ManualMapper<SimplePost>(r => { var dt = new SimplePost(34); dt.Id = (Guid)r["Id"]; dt.Name = r["Name"].ToString(); dt.SetNumber((int)r["Number"]); return dt; }); var data = Setup.FakeReader(r => { r.Clear(); r.Add("Id",Guid.NewGuid()); r.Add("Name", "bla"); r.Add("Number", 23); }); var sut = Setup.MapperFactory().CreateMapper<SimplePost>("1") as Mapper<SimplePost>; sut.Map(data); }
public override void OnInspectorGUI() { DrawDefaultInspector(); SimplePost script = (SimplePost)target; if (GUILayout.Button("Upload screen")) { script.PostSimple(); } }
public void Put([FromBody] SimplePost value) { _repository.AddPost(new Post() { Id = new Guid(), Body = value.Body, Title = value.Title, PublicationDate = DateTime.Now, LastModified = DateTime.Now }); Console.WriteLine(value); }
// [Fact] public void Benchmark() { var manual = new ManualMapper <SimplePost>(r => { var dt = new SimplePost(34); dt.Id = (Guid)r["Id"]; dt.Name = r["Name"].ToString(); dt.SetNumber((int)r["Number"]); return(dt); }); var data = Setup.FakeReader(r => { r.Clear(); r.Add("Id", Guid.NewGuid()); r.Add("Name", "bla"); r.Add("Number", 23); }); var sut = Setup.MapperFactory().CreateMapper <SimplePost>("1") as Mapper <SimplePost>; sut.Map(data); }
public void Nonlazy_collections_can_be_fetched_with_queries() { ActiveRecordStarter.Initialize(GetConfigSource(), typeof(SimpleBlog), typeof(SimplePost)); Recreate(); var blog = new SimpleBlog { Name = "Blog" }; var post = new SimplePost { Blog = blog, Title = "Post" }; blog.Save(); post.Save(); var query = new SimpleQuery<SimpleBlog>("from SimpleBlog b join fetch b.Posts"); using (new StatelessSessionScope()) { var result = query.Execute(); Assert.AreEqual(1, result.Length); Assert.AreEqual(1, result[0].Posts.Count); Assert.AreEqual("Post", result[0].Posts[0].Title); Assert.AreSame(result[0], result[0].Posts[0].Blog); } }