• 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
    
        }
    }
  • 相关阅读:
    端口监听与telnet
    strace
    Java Web SSH框架总是无法写入无法读取Cookie
    很反感Java Web 三层框架
    关于武侠游戏的一些想法(长期整理)
    奇怪的Lisp和难懂的计算机程序的构造和解释
    编程的智慧(转自王垠个人博客)——满满的编程实践经验不看就错过
    最近买了个Mac Pro,用起来感觉是去年买了个表
    Python手动构造Cookie模拟登录后获取网站页面内容
    奇怪的JS正则之 /[A-z]/.test("\"); // true
  • 原文地址:https://www.cnblogs.com/dongh/p/6603845.html
Copyright © 2020-2023  润新知