# Fdb **Repository Path**: fanyeyong/Fdb ## Basic Information - **Project Name**: Fdb - **Description**: 一款ASP.NET ORM框架。支持mysql、sqlserver、oracle、sqlite数据库。 - **Primary Language**: C# - **License**: MIT - **Default Branch**: master - **Homepage**: https://fanyeyong.com - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-05 - **Last Updated**: 2026-06-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 一、代码生成工具 用于生成数据库实体类和上下文类文件。 ![代码生成工具](https://foruda.gitee.com/images/1753176966348324846/5f4f8474_10188932.png "orm.png") 二、基础使用方法如下: //数据库上下文类 public class FDbcontext: BaseDbContext { public readonly Logic Org_user = new Logic(); public FDbcontext(string connectionString) : base(connectionString) { this.Org_user.ConnectionString = connectionString; this.Org_user.DatabaseType = _DatabaseType; } } //定义上下文对象 FDbcontext dbcontext = new FDbcontext("连接字符串名称"); //新建 ExecuteResult er = new ExecuteResult(); er = this._fDbContext.Org_user.Insert(org_user); //编辑 er = this._fDbContext.Org_user.Update(org_user); //根据主键ID获取对象 Org_user org_user = this._fDbContext.Org_user.Fetch(_id); //根据主键ID删除数据 ExecuteResult er = this._fDbContext.Org_user.Delete(_id); //获取数据列表 List org_user_list = this._fDbContext.Org_user.FetchList(); //分页查询 PagedQuery pagedQuery = new PagedQuery(); pagedQuery.IdField = "ID"; pagedQuery.PageIndex = string.IsNullOrEmpty(pageindex) ? 1 : pageindex.ToInt(); if (!string.IsNullOrEmpty(orderby)) { switch (orderby) { case "1": pagedQuery.SortClause = "NAME "; break; } pagedQuery.SortClause += (ordertype == "0" ? "desc" : "asc"); } else { pagedQuery.SortClause = "ID desc"; } Org_user org_user = new Org_user(); if (!string.IsNullOrEmpty(keyword)) { org_user.CNNAME = "%" + keyword + "%"; org_user.LOGINNAME = "%" + keyword + "%"; } pagedQuery.PageSize = this._PageSize; result.Data = this._fDbContext.Org_user.FetchPageList(org_user, pagedQuery); result.Success = true; result.Total = this._fDbContext.Org_user.FetchCount(pagedQuery); result.PageSize = this._PageSize;