# Lails.Data **Repository Path**: Lails/Lails.Data ## Basic Information - **Project Name**: Lails.Data - **Description**: Lails.Data - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-11-04 - **Last Updated**: 2022-02-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 一、介绍 基于Dapper的数据库访问组件。 * Git:https://gitee.com/xiaosonl/Lails.Data ### 二、安装 ```powershell Install-Package Lails.Data ``` ### 三、说明 #### 1. 创建实体对象 组件提供了EntityBase实体基类,用户实体如继承(可选)EntityBase,可实现对创建时间及修改时间进行自动更新。 ```c# public class UserInfo : EntityBase { public string Name { get; set; } public string Password { get; set; } } ``` #### 2. 创建表 现版本仍需手动创建表结构,下一版本将实现自动创建表结构。 * 如继承至EntityBase,可使用下面基础表结构模板: ```sql CREATE TABLE {表名} ( `Id` BIGINT AUTO_INCREMENT, `CreateTime` DATE, `EditTime` DATE, PRIMARY KEY ( `Id`) ) ``` ### 四、示例 ```c# string conn = "server=mysql.lails.cc;initial catalog=lails;uid=demo;pwd=demo"; DbClient client = new DbClient(conn, DbType.MYSql); UserInfo user = new UserInfo() { Name = "xiaoonl", Password = "12345" }; client.Add(user); ```