Esempio n. 1
0
        public async void ReadDataTest()
        {
            using (var context = new Api1Context(_options))
            {
                var logic = new BlogLogic(context);
                context.Database.EnsureCreated();

                Blog tdBlog = new Blog();
                tdBlog.BlogId = 0;
                tdBlog.Url    = "https://test.test";

                Post tdPost = new Post();
                tdPost.PostId = 0;
                tdPost.Title  = "post0";
                tdPost.BlogId = 0;

                tdBlog.Posts = new List <Post>();
                tdBlog.Posts.Add(tdPost);


                await logic.CreateData(tdBlog, DateTime.Now, "test", "test");

                JoinA tdJoinA = new JoinA();
                tdJoinA.BlogId  = 1;
                tdJoinA.JoinAId = 2;

                context.Entry(tdJoinA).State = EntityState.Added;
                await context.SaveChangesAsync();

                List <BlogJoinA> blogs = await logic.ReadDatas();

                Console.WriteLine(blogs.Count);
                Console.WriteLine(blogs[0].Blog.BlogId);
                Console.WriteLine(blogs[0].JoinA.JoinAId);

                Assert.True(1 == 1);
            }

            using (var context = new Api1Context(_options))
            {
                IQueryable <Blog> blog = context.Blog.Where(b => b.BlogId == 1);


                var sql = blog.ToSqll();
            }
        }
 public ValuesController(Api1Context context, IEventBus eventBus)
 {
     _context  = context;
     _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus));
 }
Esempio n. 3
0
 public CompanyLogic(Api1Context context)
 {
     _context = context;
 }
Esempio n. 4
0
 public BlogLogic(Api1Context context)
 {
     _context = context;
 }
Esempio n. 5
0
 public Api1Controller(Api1Context context)
 {
     _context = context;
     _logic   = new BlogLogic(context);
 }
Esempio n. 6
0
 public BlogTest(Api1Context context)
 {
     _context = context;
 }
Esempio n. 7
0
 public PostLogic(Api1Context context)
 {
     _context = context;
 }