从 LinqToSQL 转换为 Linq2DB

问题描述 投票:0回答:0

我有一个项目,其中已创建现有的 SQL Linq 连接和完整的 DBML。现在我需要将相同的代码转换为从 MySQL 访问(不要问为什么......这很复杂)。 我已经从 NuGet (VS2019) 安装了 Linq2DB,并试图将代码转换为使用 Linq2DB 对象。 我包括了 DBML 设计器的一部分代码页,尽管可能只需要一小部分来告诉我需要做什么:

namespace MCAIntranet.LINQ
{
    using System.Data.Linq;
    using System.Data.Linq.Mapping;
    using System.Data;
    using System.Collections.Generic;
    using System.Reflection;
    using System.Linq;
    using System.Linq.Expressions;
    
    
    [global::System.Data.Linq.Mapping.DatabaseAttribute(Name="Corporate_Morning_Reports")]
    public partial class CMRDataContext : System.Data.Linq.DataContext
    {
        
        private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();

        #region Extensibility Method Definitions
        partial void OnCreated();
    partial void InserttblCollectorCode(MCAIntranet.LINQ.CMR.tblCollectorCode instance);
    partial void UpdatetblCollectorCode(MCAIntranet.LINQ.CMR.tblCollectorCode instance);
    partial void DeletetblCollectorCode(MCAIntranet.LINQ.CMR.tblCollectorCode instance);
    partial void InserttblBranch(MCAIntranet.LINQ.CMR.tblBranch instance);
    partial void UpdatetblBranch(MCAIntranet.LINQ.CMR.tblBranch instance);
    partial void DeletetblBranch(MCAIntranet.LINQ.CMR.tblBranch instance);
    partial void InserttblClient(MCAIntranet.LINQ.CMR.tblClient instance);
    partial void UpdatetblClient(MCAIntranet.LINQ.CMR.tblClient instance);
    partial void DeletetblClient(MCAIntranet.LINQ.CMR.tblClient instance);
    partial void InserttblHoliday(MCAIntranet.LINQ.CMR.tblHoliday instance);
    partial void UpdatetblHoliday(MCAIntranet.LINQ.CMR.tblHoliday instance);
    partial void DeletetblHoliday(MCAIntranet.LINQ.CMR.tblHoliday instance);
    partial void InserttblTarget(MCAIntranet.LINQ.CMR.tblTarget instance);
    partial void UpdatetblTarget(MCAIntranet.LINQ.CMR.tblTarget instance);
    partial void DeletetblTarget(MCAIntranet.LINQ.CMR.tblTarget instance);
    partial void InserttblCollector(MCAIntranet.LINQ.CMR.tblCollector instance);
    partial void UpdatetblCollector(MCAIntranet.LINQ.CMR.tblCollector instance);
    partial void DeletetblCollector(MCAIntranet.LINQ.CMR.tblCollector instance);
    partial void InserttblCommission(MCAIntranet.LINQ.CMR.tblCommission instance);
    partial void UpdatetblCommission(MCAIntranet.LINQ.CMR.tblCommission instance);
    partial void DeletetblCommission(MCAIntranet.LINQ.CMR.tblCommission instance);
    partial void InserttblDeletedEmployee(MCAIntranet.LINQ.CMR.tblDeletedEmployee instance);
    partial void UpdatetblDeletedEmployee(MCAIntranet.LINQ.CMR.tblDeletedEmployee instance);
    partial void DeletetblDeletedEmployee(MCAIntranet.LINQ.CMR.tblDeletedEmployee instance);
    partial void InserttblReportColor(MCAIntranet.LINQ.CMR.tblReportColor instance);
    partial void UpdatetblReportColor(MCAIntranet.LINQ.CMR.tblReportColor instance);
    partial void DeletetblReportColor(MCAIntranet.LINQ.CMR.tblReportColor instance);
    partial void InserttblManager(MCAIntranet.LINQ.CMR.tblManager instance);
    partial void UpdatetblManager(MCAIntranet.LINQ.CMR.tblManager instance);
    partial void DeletetblManager(MCAIntranet.LINQ.CMR.tblManager instance);
    partial void InserttblAccessLevel(MCAIntranet.LINQ.CMR.tblAccessLevel instance);
    partial void UpdatetblAccessLevel(MCAIntranet.LINQ.CMR.tblAccessLevel instance);
    partial void DeletetblAccessLevel(MCAIntranet.LINQ.CMR.tblAccessLevel instance);
    partial void InserttblLanguage(MCAIntranet.LINQ.CMR.tblLanguage instance);
    partial void UpdatetblLanguage(MCAIntranet.LINQ.CMR.tblLanguage instance);
    partial void DeletetblLanguage(MCAIntranet.LINQ.CMR.tblLanguage instance);
    partial void InserttblLanguagesSpoken(MCAIntranet.LINQ.CMR.tblLanguagesSpoken instance);
    partial void UpdatetblLanguagesSpoken(MCAIntranet.LINQ.CMR.tblLanguagesSpoken instance);
    partial void DeletetblLanguagesSpoken(MCAIntranet.LINQ.CMR.tblLanguagesSpoken instance);
        #endregion

        public CMRDataContext() : 
                base(global::System.Configuration.ConfigurationManager.ConnectionStrings["mcaintranetConnectionString"].ConnectionString, mappingSource)
        {
            OnCreated();
        }
        
        
        public CMRDataContext(string connection) : 
                base(connection, mappingSource)
        {
            OnCreated();
        }
        
        public CMRDataContext(System.Data.IDbConnection connection) : 
                base(connection, mappingSource)
        {
            OnCreated();
        }
        
        public CMRDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
                base(connection, mappingSource)
        {
            OnCreated();
        }
        
        public CMRDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
                base(connection, mappingSource)
        {
            OnCreated();
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblCollectorCode> tblCollectorCodes
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblCollectorCode>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblBranch> tblBranches
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblBranch>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblClient> tblClients
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblClient>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblHoliday> tblHolidays
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblHoliday>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblTarget> tblTargets
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblTarget>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblPageValue> tblPageValues
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblPageValue>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.vwCollector> vwCollectors
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.vwCollector>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.vwManager> vwManagers
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.vwManager>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.vwCodesCollector> vwCodesCollectors
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.vwCodesCollector>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.vwDataHistory> vwDataHistories
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.vwDataHistory>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.vwLanguage> vwLanguages
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.vwLanguage>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.vwTarget> vwTargets
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.vwTarget>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblCollector> tblCollectors
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblCollector>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblCommission> tblCommissions
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblCommission>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblDeletedEmployee> tblDeletedEmployees
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblDeletedEmployee>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblReportColor> tblReportColors
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblReportColor>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.vwEmployeeLicense> vwEmployeeLicenses
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.vwEmployeeLicense>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblManager> tblManagers
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblManager>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblAccessLevel> tblAccessLevels
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblAccessLevel>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblLanguage> tblLanguages
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblLanguage>();
            }
        }
        
        public System.Data.Linq.Table<MCAIntranet.LINQ.CMR.tblLanguagesSpoken> tblLanguagesSpokens
        {
            get
            {
                return this.GetTable<MCAIntranet.LINQ.CMR.tblLanguagesSpoken>();
            }
        }
    }
}
namespace MCAIntranet.LINQ.CMR
{
    using System.Data.Linq;
    using System.Data.Linq.Mapping;
    using System.ComponentModel;
    using System;
    
    
    
    [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.tblBranches")]
    public partial class tblBranch : INotifyPropertyChanging, INotifyPropertyChanged
    {
        
        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        
        private int _id;
        
        private string _BranchName;
        
        private string _BranchPhone;
        
        private EntitySet<tblCollectorCode> _tblCollectorCodes;
        
        private EntityRef<tblCommission> _tblCommission;
        
        private EntityRef<tblCollectorCode> _tblCollectorCode;
        
        
        public tblBranch()
        {
            this._tblCollectorCodes = new EntitySet<tblCollectorCode>(new Action<tblCollectorCode>(this.attach_tblCollectorCodes), new Action<tblCollectorCode>(this.detach_tblCollectorCodes));
            this._tblCommission = default(EntityRef<tblCommission>);
            this._tblCollectorCode = default(EntityRef<tblCollectorCode>);
            OnCreated();
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_id", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
        public int id
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((this._id != value))
                {
                    if ((this._tblCommission.HasLoadedOrAssignedValue || this._tblCollectorCode.HasLoadedOrAssignedValue))
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.OnidChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("id");
                    this.OnidChanged();
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BranchName", DbType="NVarChar(20) NOT NULL", CanBeNull=false)]
        public string BranchName
        {
            get
            {
                return this._BranchName;
            }
            set
            {
                if ((this._BranchName != value))
                {
                    this.OnBranchNameChanging(value);
                    this.SendPropertyChanging();
                    this._BranchName = value;
                    this.SendPropertyChanged("BranchName");
                    this.OnBranchNameChanged();
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BranchPhone", DbType="NVarChar(13)")]
        public string BranchPhone
        {
            get
            {
                return this._BranchPhone;
            }
            set
            {
                if ((this._BranchPhone != value))
                {
                    this.OnBranchPhoneChanging(value);
                    this.SendPropertyChanging();
                    this._BranchPhone = value;
                    this.SendPropertyChanged("BranchPhone");
                    this.OnBranchPhoneChanged();
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.AssociationAttribute(Name="tblBranch_tblCollectorCode", Storage="_tblCollectorCodes", ThisKey="id", OtherKey="branch")]
        public EntitySet<tblCollectorCode> tblCollectorCodes
        {
            get
            {
                return this._tblCollectorCodes;
            }
            set
            {
                this._tblCollectorCodes.Assign(value);
            }
        }
        
        [global::System.Data.Linq.Mapping.AssociationAttribute(Name="tblCommission_tblBranch", Storage="_tblCommission", ThisKey="id", OtherKey="branch", IsForeignKey=true)]
        public tblCommission tblCommission
        {
            get
            {
                return this._tblCommission.Entity;
            }
            set
            {
                tblCommission previousValue = this._tblCommission.Entity;
                if (((previousValue != value) 
                            || (this._tblCommission.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging();
                    if ((previousValue != null))
                    {
                        this._tblCommission.Entity = null;
                        previousValue.tblBranches.Remove(this);
                    }
                    this._tblCommission.Entity = value;
                    if ((value != null))
                    {
                        value.tblBranches.Add(this);
                        this._id = value.branch;
                    }
                    else
                    {
                        this._id = default(int);
                    }
                    this.SendPropertyChanged("tblCommission");
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.AssociationAttribute(Name="tblCollectorCode_tblBranch", Storage="_tblCollectorCode", ThisKey="id", OtherKey="branch", IsForeignKey=true)]
        public tblCollectorCode tblCollectorCode
        {
            get
            {
                return this._tblCollectorCode.Entity;
            }
            set
            {
                tblCollectorCode previousValue = this._tblCollectorCode.Entity;
                if (((previousValue != value) 
                            || (this._tblCollectorCode.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging();
                    if ((previousValue != null))
                    {
                        this._tblCollectorCode.Entity = null;
                        previousValue.tblBranches.Remove(this);
                    }
                    this._tblCollectorCode.Entity = value;
                    if ((value != null))
                    {
                        value.tblBranches.Add(this);
                        this._id = value.branch;
                    }
                    else
                    {
                        this._id = default(int);
                    }
                    this.SendPropertyChanged("tblCollectorCode");
                }
            }
        }
        
        public event PropertyChangingEventHandler PropertyChanging;
        
        public event PropertyChangedEventHandler PropertyChanged;
        
        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }
        
        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        
        private void attach_tblCollectorCodes(tblCollectorCode entity)
        {
            this.SendPropertyChanging();
            entity.tblBranch = this;
        }
        
        private void detach_tblCollectorCodes(tblCollectorCode entity)
        {
            this.SendPropertyChanging();
            entity.tblBranch = null;
        }
    }
    
    [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.tblClients")]
    public partial class tblClient : INotifyPropertyChanging, INotifyPropertyChanged
    {
        
        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        
        private int _id;
        
        private string _ClientName;
        
        private string _ClientContact;
        
        private string _ClientPhone;
        
        private EntitySet<tblCollectorCode> _tblCollectorCodes;
        
        private EntityRef<tblCommission> _tblCommission;
        
        private EntityRef<tblCollectorCode> _tblCollectorCode;
        
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnidChanging(int value);
    partial void OnidChanged();
    partial void OnClientNameChanging(string value);
    partial void OnClientNameChanged();
    partial void OnClientContactChanging(string value);
    partial void OnClientContactChanged();
    partial void OnClientPhoneChanging(string value);
    partial void OnClientPhoneChanged();
    #endregion
        
        public tblClient()
        {
            this._tblCollectorCodes = new EntitySet<tblCollectorCode>(new Action<tblCollectorCode>(this.attach_tblCollectorCodes), new Action<tblCollectorCode>(this.detach_tblCollectorCodes));
            this._tblCommission = default(EntityRef<tblCommission>);
            this._tblCollectorCode = default(EntityRef<tblCollectorCode>);
            OnCreated();
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_id", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
        public int id
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((this._id != value))
                {
                    if ((this._tblCommission.HasLoadedOrAssignedValue || this._tblCollectorCode.HasLoadedOrAssignedValue))
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.OnidChanging(value);
                    this.SendPropertyChanging();
                    this._id = value;
                    this.SendPropertyChanged("id");
                    this.OnidChanged();
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
        public string ClientName
        {
            get
            {
                return this._ClientName;
            }
            set
            {
                if ((this._ClientName != value))
                {
                    this.OnClientNameChanging(value);
                    this.SendPropertyChanging();
                    this._ClientName = value;
                    this.SendPropertyChanged("ClientName");
                    this.OnClientNameChanged();
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientContact", DbType="NVarChar(50)")]
        public string ClientContact
        {
            get
            {
                return this._ClientContact;
            }
            set
            {
                if ((this._ClientContact != value))
                {
                    this.OnClientContactChanging(value);
                    this.SendPropertyChanging();
                    this._ClientContact = value;
                    this.SendPropertyChanged("ClientContact");
                    this.OnClientContactChanged();
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ClientPhone", DbType="NVarChar(20)")]
        public string ClientPhone
        {
            get
            {
                return this._ClientPhone;
            }
            set
            {
                if ((this._ClientPhone != value))
                {
                    this.OnClientPhoneChanging(value);
                    this.SendPropertyChanging();
                    this._ClientPhone = value;
                    this.SendPropertyChanged("ClientPhone");
                    this.OnClientPhoneChanged();
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.AssociationAttribute(Name="tblClient_tblCollectorCode", Storage="_tblCollectorCodes", ThisKey="id", OtherKey="client")]
        public EntitySet<tblCollectorCode> tblCollectorCodes
        {
            get
            {
                return this._tblCollectorCodes;
            }
            set
            {
                this._tblCollectorCodes.Assign(value);
            }
        }
        
        [global::System.Data.Linq.Mapping.AssociationAttribute(Name="tblCommission_tblClient", Storage="_tblCommission", ThisKey="id", OtherKey="client", IsForeignKey=true)]
        public tblCommission tblCommission
        {
            get
            {
                return this._tblCommission.Entity;
            }
            set
            {
                tblCommission previousValue = this._tblCommission.Entity;
                if (((previousValue != value) 
                            || (this._tblCommission.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging();
                    if ((previousValue != null))
                    {
                        this._tblCommission.Entity = null;
                        previousValue.tblClients.Remove(this);
                    }
                    this._tblCommission.Entity = value;
                    if ((value != null))
                    {
                        value.tblClients.Add(this);
                        this._id = value.client;
                    }
                    else
                    {
                        this._id = default(int);
                    }
                    this.SendPropertyChanged("tblCommission");
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.AssociationAttribute(Name="tblCollectorCode_tblClient", Storage="_tblCollectorCode", ThisKey="id", OtherKey="client", IsForeignKey=true)]
        public tblCollectorCode tblCollectorCode
        {
            get
            {
                return this._tblCollectorCode.Entity;
            }
            set
            {
                tblCollectorCode previousValue = this._tblCollectorCode.Entity;
                if (((previousValue != value) 
                            || (this._tblCollectorCode.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging();
                    if ((previousValue != null))
                    {
                        this._tblCollectorCode.Entity = null;
                        previousValue.tblClients.Remove(this);
                    }
                    this._tblCollectorCode.Entity = value;
                    if ((value != null))
                    {
                        value.tblClients.Add(this);
                        this._id = value.client;
                    }
                    else
                    {
                        this._id = default(int);
                    }
                    this.SendPropertyChanged("tblCollectorCode");
                }
            }
        }
        
        public event PropertyChangingEventHandler PropertyChanging;
        
        public event PropertyChangedEventHandler PropertyChanged;
        
        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }
        
        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        
        private void attach_tblCollectorCodes(tblCollectorCode entity)
        {
            this.SendPropertyChanging();
            entity.tblClient = this;
        }
        
        private void detach_tblCollectorCodes(tblCollectorCode entity)
        {
            this.SendPropertyChanging();
            entity.tblClient = null;
        }
    }
    

    
    [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.vwTargets")]
    public partial class vwTarget
    {
        
        private System.Nullable<decimal> _Target;
        
        private System.Nullable<decimal> _StartDate;
        
        private System.Nullable<decimal> _EndDate;
        
        private System.Nullable<decimal> _id;
        
        private string _Code;
        
        public vwTarget()
        {
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Target", DbType="Decimal(10,2)")]
        public System.Nullable<decimal> Target
        {
            get
            {
                return this._Target;
            }
            set
            {
                if ((this._Target != value))
                {
                    this._Target = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="Decimal(10,0)")]
        public System.Nullable<decimal> StartDate
        {
            get
            {
                return this._StartDate;
            }
            set
            {
                if ((this._StartDate != value))
                {
                    this._StartDate = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="Decimal(10,0)")]
        public System.Nullable<decimal> EndDate
        {
            get
            {
                return this._EndDate;
            }
            set
            {
                if ((this._EndDate != value))
                {
                    this._EndDate = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_id", DbType="Decimal(10,0)")]
        public System.Nullable<decimal> id
        {
            get
            {
                return this._id;
            }
            set
            {
                if ((this._id != value))
                {
                    this._id = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Code", DbType="VarChar(20)")]
        public string Code
        {
            get
            {
                return this._Code;
            }
            set
            {
                if ((this._Code != value))
                {
                    this._Code = value;
                }
            }
        }
    }
    
    
    [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.vwEmployeeLicenses")]
    public partial class vwEmployeeLicense
    {
        
        private string _PEmployeeID;
        
        private string _PFirstName;
        
        private string _PLastName;
        
        private System.DateTime _Start_Date;
        
        private System.DateTime _Terminated;
        
        private string _Branch;
        
        private System.Nullable<int> _BranchNumber;
        
        public vwEmployeeLicense()
        {
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PEmployeeID", DbType="Char(15) NOT NULL", CanBeNull=false)]
        public string PEmployeeID
        {
            get
            {
                return this._PEmployeeID;
            }
            set
            {
                if ((this._PEmployeeID != value))
                {
                    this._PEmployeeID = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PFirstName", DbType="Char(15) NOT NULL", CanBeNull=false)]
        public string PFirstName
        {
            get
            {
                return this._PFirstName;
            }
            set
            {
                if ((this._PFirstName != value))
                {
                    this._PFirstName = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PLastName", DbType="Char(21) NOT NULL", CanBeNull=false)]
        public string PLastName
        {
            get
            {
                return this._PLastName;
            }
            set
            {
                if ((this._PLastName != value))
                {
                    this._PLastName = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name="[Start Date]", Storage="_Start_Date", DbType="DateTime NOT NULL")]
        public System.DateTime Start_Date
        {
            get
            {
                return this._Start_Date;
            }
            set
            {
                if ((this._Start_Date != value))
                {
                    this._Start_Date = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Terminated", DbType="DateTime NOT NULL")]
        public System.DateTime Terminated
        {
            get
            {
                return this._Terminated;
            }
            set
            {
                if ((this._Terminated != value))
                {
                    this._Terminated = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Branch", DbType="NVarChar(23)")]
        public string Branch
        {
            get
            {
                return this._Branch;
            }
            set
            {
                if ((this._Branch != value))
                {
                    this._Branch = value;
                }
            }
        }
        
        [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BranchNumber", DbType="Int")]
        public System.Nullable<int> BranchNumber
        {
            get
            {
                return this._BranchNumber;
            }
            set
            {
                if ((this._BranchNumber != value))
                {
                    this._BranchNumber = value;
                }
            }
        }
    }
}

此代码由 IDE 中的 Add New Linq To SQL 对象生成。如何使用 MySQL 将其转移到 LinqToDB?

c# linq linq-to-sql mysql-connector
© www.soinside.com 2019 - 2024. All rights reserved.