Program.cs

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using FluentData.Core;
using System.Collections;
using System.Collections.ObjectModel;
using System.Data;
using System.Runtime.Intrinsics.X86;
using System.Security.Principal;

namespace Demo1
{
    internal class Program
    {
        private static IDbContext _Context { get; set; }
        static Program()
        {
            _Context = Context();
        }

        static void Main(string[] args)
        {
            mm();
        }

        static IDbContext Context()
        {
            return new DbContext()
                .ConnectionString("Server=.;Database=BookDB;Trusted_Connection=True", new SqlServerProvider());
        }

        static IDbContext Context_()
        {
            return new DbContext().ConnectionStringName("MyDatabase",
                    new SqlServerProvider());
        }

        static void m1()
        {
            // 返回 dynamic类型的List 集合:
            List<dynamic> list = _Context.Sql("select * from BookInfo").QueryMany<dynamic>();
        }

        static void m2()
        {
            // 返回强类型的List 集合
            List<BookInfo> list = _Context.Sql("select * from BookInfo").QueryMany<BookInfo>();
        }

        static void m3()
        {
            // 返回一个自定义类型的集合类型:
            ICollection<BookInfo> books = _Context.Sql("select * from BookInfo").QueryMany<BookInfo, List<BookInfo>>();
        }

        static void m4()
        {
            // 返回单个动态对象数据表
            dynamic bookinfo = _Context.Sql("select * from BookInfo where BookID=1").QuerySingle<dynamic>();
        }

        static void m5()
        {
后面还有 379 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。