zoukankan      html  css  js  c++  java
  • Dapper连接Oracle

    首先创建数据库连接,代码如下:

        public class DapperFactory
        {
            public static readonly string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["Wip_TestConnStr"].ToString();
    
    
            public static OracleConnection CrateOracleConnection()
            {
                var connection = new OracleConnection(connectionString);
                connection.Open();
                return connection;
            }
    
        }

    其次,基于Oracle,实现简单的增、删、改、查、事务、分页等。

    using System;
    using System.Data;
    using System.Collections;
    using System.Xml;
    using System.Runtime.Serialization;
    namespace Tcl.ForLog.Model
    {
        /// <summary>
        /// 表WUFEI_TESTTB的对象类    
        /// </summary> 
        [DataContract(Name = "WUFEI_TESTTB")]
        public class WUFEI_TESTTBModel
        {
            #region 表名称常量
    
            /// <summary>
            /// 表名称
            /// </summary>
            public const string TABLE_NAME = "WUFEI_TESTTB";
    
            #endregion
    
            #region 属性
    
            /// <summary>
            /// 用户ID
            /// </summary>
            [DataMember(Name = "USER_ID")]
            public decimal USER_ID { get; set; }
    
            /// <summary>
            /// 用户名称
            /// </summary>
            [DataMember(Name = "USER_NAME")]
            public string USER_NAME { get; set; }
    
            /// <summary>
            /// 用户地址
            /// </summary>
            [DataMember(Name = "USER_ADDRESS")]
            public string USER_ADDRESS { get; set; }
    
            /// <summary>
            /// 用户性别
            /// </summary>
            [DataMember(Name = "USER_SEX")]
            public string USER_SEX { get; set; }
    
            /// <summary>
            /// 用户生日
            /// </summary>
            [DataMember(Name = "USER_BIRTHDAY")]
            public DateTime USER_BIRTHDAY { get; set; }
    
            /// <summary>
            /// 备注
            /// </summary>
            [DataMember(Name = "USER_REMARK")]
            public string USER_REMARK { get; set; }
    
            /// <summary>
            /// WUFEI_TESTTBModel深拷贝
            /// </summary>
            /// <returns></returns>
            public static WUFEI_TESTTBModel DeepCopy(WUFEI_TESTTBModel testTbA)
            {
                WUFEI_TESTTBModel testTbB = new WUFEI_TESTTBModel();
                testTbB.USER_ID = testTbA.USER_ID;
                testTbB.USER_NAME = testTbA.USER_NAME;
                testTbB.USER_ADDRESS = testTbA.USER_ADDRESS;
                testTbB.USER_SEX = testTbA.USER_SEX;
                testTbB.USER_BIRTHDAY = testTbA.USER_BIRTHDAY;
                testTbB.USER_REMARK = testTbA.USER_REMARK;
    
                return testTbB;
            }
            #endregion
    
        }
    }
  • 相关阅读:
    Yii together
    linux 文件处理大杂烩
    Ubuntu 17.10 环境初始化
    关掉 ubuntu bug 报告功能
    git svn 流程
    [Mac] How do I move a window whose title bar is off-screen?
    可爱的Python_课后习题_CDay−5 Python 初体验和原始需求
    python_编程规范
    python_excel
    python_os
  • 原文地址:https://www.cnblogs.com/dongh/p/6603845.html
Copyright © 2011-2022 走看看