`
ljl_xyf
  • 浏览: 633997 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

C#3.0入门系列(LinQ)(七)-之OR工具介绍

阅读更多

不得不再次给关注 dlinq的朋友道歉了。好久都没有更新 blog了。因为工作的变动,还要赶期限,没有时间关注这里了。

先发布一则消息。 Orcas Beta1 这个才是 beta1,可以到 http://www.microsoft.com/downloads/details.aspx?FamilyID=f10fb5df-e369-4db4-b9a7-845dbf793368&DisplayLang=en 下载。 5 1号的版本。最早 4 19号就出来过一个,只是没有在意。还有一个 http://www.microsoft.com/downloads/details.aspx?FamilyID=36b6609e-6f3d-40f4-8c7d-ad111679d8dc&DisplayLang=en

http://www.my400800.cn 一个是 self-extracting 版本的,一个是 Virtual PC version的。不知道什么区别。没有装过。

 

本节舍去原来的计划,而改讲映射工具。在入门三一文中,我们提到了 sqlmetal这个工具。 http://www.cnblogs.com/126/archive/2006/09/06/492332.html sqlmetal的功能是将数据库的信息抽提出来,生成映射代码。 Orcas还有另外一个工具,就是 O/R Designer.

先讲 sqlmetal. 自上次的版本后, sqlmetal,又增加了一些新的功能。比如,支持 SQLCE版本的 Sql Server, 支持直接输入 connection string 等等。 这是 sqlmetal的帮助信息,是不是比上次多了很多?

 

 

Microsoft (R) Database Mapping Generator 2008 Beta 2 version 1.00.20612
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

SqlMetal [options] [<input file>]

  Generates code and mapping for the LINQ to SQL component of the .NET framework. SqlMetal can:
  - Generate source code and mapping attributes or a mapping file from a database.
  - Generate an intermediate dbml file for customization from the database.
  - Generate code and mapping attributes or mapping file from a dbml file.

Options:
  /server:<name>             Database server name.
  /database:<name>           Database catalog on server.
  /user:<name>               Login user ID (default: use Windows Authentication).
  /password:<password>       Login password (default: use Windows Authentication).
  /conn:<connection string>  Database connection string. Cannot be used with /server, /database, /us
er or /password options.
  /timeout:<seconds>         Timeout value to use when SqlMetal accesses the database (default: 0 wh
ich means infinite).

  /views                     Extract database views.
  /functions                 Extract database functions.
  /sprocs                    Extract stored procedures.

  /dbml[:file]               Output as dbml. Cannot be used with /map option.
  /code[:file]               Output as source code. Cannot be used with /dbml option.
  /map[:file]                Generate mapping file, not attributes. Cannot be used with /dbml option
.

  /language:<language>       Language for source code: VB or C# (default: derived from extension on code file name).
  /namespace:<name>          Namespace of generated code (default: no namespace).
  /context:<type>            Name of data context class (default: derived from database name).
  /entitybase:<type>         Base class of entity classes in the generated code (default: entities have no base class).
  /pluralize                 Automatically pluralize or singularize class and member names using English language rules.
  /serialization:<option>    Generate serializable classes: None or Unidirectional (default: None).
  /provider:<type>           Provider type (default: provider is determined at run time).

  <input file>               May be a SqlExpress mdf file, a SqlCE sdf file, or a dbml intermediate file.

Create code from SqlServer:
  SqlMetal /server:myserver /database:northwind /code:nwind.cs /namespace:nwind

Generate intermediate dbml file from SqlServer:
  SqlMetal /server:myserver /database:northwind /dbml:northwind.dbml /namespace:nwind

Generate code with external mapping from dbml:
  SqlMetal /code:nwind.cs /map:nwind.map northwind.dbml

Generate dbml from a SqlCE sdf file:
  SqlMetal /dbml:northwind.dbml northwind.sdf

Generate dbml from SqlExpress local server:
  SqlMetal /server:.\sqlexpress /database:northwind /dbml:northwind.dbml

Generate dbml by using a connection string in the command line:
  SqlMetal /conn:"server='myserver'; database='northwind'" /dbml:northwind.dbml

 

 

因为 sqlmetal已经讲过,不再多讲,大家知道它是个命令行的工具,用来做映射数据库信息的,会使用就可以。 再接着讲 O/R Designer. 新建任一工程。右击工程,选择 add->new item. 如图所示:


弹出 item 对话框, category 中选择 data, 然后选择 Linq to Sql Class 如图所示:


选择添加。这样,你的工程就多了一个 O/R Desiger项目。 在菜单 View->Sever Explore 打开 Sever Explore,添加一个 Data Connection, 如图所示:


后,填写数据库服务器,用户名,密码和数据库名。如果,你没有,你可以使用 Sql Express 版本。添加之后的效果,如图所示:


 

打开刚才添加的 DataClasses1.dbml 文件,将 Sever Explore中的 Customer 表或 view拖入 Designer中来,如图所示:



也可以将
Store procedure User define function 拖进来,会在方法面板上形成方法。如图所示:



如果,两个表之间有关系, OR Designer可以显示它们的关系,将 Order表和 OderDetail表拖入 如图所示:


打开 DataClasses1. Designer.cs 文件,你就可以看到 OR Designer 给你产生的映射代码了。

 

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;
    using System.ComponentModel;
    using System;
    
    
    [System.Data.Linq.Mapping.DatabaseAttribute(Name="northwind_may06ctp")]
    public partial class DataClasses1DataContext : System.Data.Linq.DataContext
    {
        
        private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
        
    Extensibility Method Definitions#region Extensibility Method Definitions
    partial void OnCreated();
    partial void InsertOrder(Order instance);
    partial void UpdateOrder(Order instance);
    partial void DeleteOrder(Order instance);
    partial void InsertOrder_Detail(Order_Detail instance);
    partial void UpdateOrder_Detail(Order_Detail instance);
    partial void DeleteOrder_Detail(Order_Detail instance);
    #endregion
        
        static DataClasses1DataContext()
        {
        }
        
        public DataClasses1DataContext(string connection) : 
                base(connection, mappingSource)
        {
            OnCreated();
        }
        
        public DataClasses1DataContext(System.Data.IDbConnection connection) : 
                base(connection, mappingSource)
        {
            OnCreated();
        }
        
        public DataClasses1DataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
                base(connection, mappingSource)
        {
            OnCreated();
        }
        
        public DataClasses1DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
                base(connection, mappingSource)
        {
            OnCreated();
        }
        
        public DataClasses1DataContext() : 
                base(global::SqlMetalUtil.Properties.Settings.Default.northwind_may06ctpConnectionString, mappingSource)
        {
            OnCreated();
        }
        
        public System.Data.Linq.Table<Order> Orders
        {
            get
            {
                return this.GetTable<Order>();
            }
        }
        
        public System.Data.Linq.Table<Order_Detail> Order_Details
        {
            get
            {
                return this.GetTable<Order_Detail>();
            }
        }
        
        [Function(Name="dbo.CategoriesInsert")]
        public int CategoriesInsert([Parameter(Name="@CategoryID", DbType="int")] System.Nullable<int> CategoryID, [Parameter(Name="@CategoryName", DbType="nvarchar")] string CategoryName, [Parameter(Name="@Description", DbType="ntext")] string Description, [Parameter(Name="@Picture", DbType="image")] byte[] Picture)
        {
            IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), CategoryID, CategoryName, Description, Picture);
            return ((int)(result.ReturnValue));
        }
    }
    
    [Table(Name="dbo.Orders")]
    public partial class Order : INotifyPropertyChanging, INotifyPropertyChanged
    {
        
        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        
        private int _OrderID;
        
        private string _CustomerID;
        
        private System.Nullable<int> _EmployeeID;
        
        private System.Nullable<System.DateTime> _OrderDate;
        
        private System.Nullable<System.DateTime> _RequiredDate;
        
        private System.Nullable<System.DateTime> _ShippedDate;
        
        private System.Nullable<int> _ShipVia;
        
        private System.Nullable<decimal> _Freight;
        
        private string _ShipName;
        
        private string _ShipAddress;
        
        private string _ShipCity;
        
        private string _ShipRegion;
        
        private string _ShipPostalCode;
        
        private string _ShipCountry;
        
        private EntitySet<Order_Detail> _Order_Details;
        
    Extensibility Method Definitions#region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate();
    partial void OnCreated();
    partial void OnOrderIDChanging(int value);
    partial void OnOrderIDChanged();
    partial void OnCustomerIDChanging(string value);
    partial void OnCustomerIDChanged();
    partial void OnEmployeeIDChanging(System.Nullable<int> value);
    partial void OnEmployeeIDChanged();
    partial void OnOrderDateChanging(System.Nullable<System.DateTime> value);
    partial void OnOrderDateChanged();
    partial void OnRequiredDateChanging(System.Nullable<System.DateTime> value);
    partial void OnRequiredDateChanged();
    partial void OnShippedDateChanging(System.Nullable<System.DateTime> value);
    partial void OnShippedDateChanged();
    partial void OnShipViaChanging(System.Nullable<int> value);
    partial void OnShipViaChanged();
    partial void OnFreightChanging(System.Nullable<decimal> value);
    partial void OnFreightChanged();
    partial void OnShipNameChanging(string value);
    partial void OnShipNameChanged();
    partial void OnShipAddressChanging(string value);
    partial void OnShipAddressChanged();
    partial void OnShipCityChanging(string value);
    partial void OnShipCityChanged();
    partial void OnShipRegionChanging(string value);
    partial void OnShipRegionChanged();
    partial void OnShipPostalCodeChanging(string value);
    partial void OnShipPostalCodeChanged();
    partial void OnShipCountryChanging(string value);
    partial void OnShipCountryChanged();
    #endregion
        
        public Order()
        {
            OnCreated();
            this._Order_Details = new EntitySet<Order_Detail>(new Action<Order_Detail>(this.attach_Order_Details), new Action<Order_Detail>(this.detach_Order_Details));
        }
        
        [Column(Storage="_OrderID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
        public int OrderID
        {
            get
            {
                return this._OrderID;
            }
            set
            {
                if ((this._OrderID != value))
                {
                    this.OnOrderIDChanging(value);
                    this.SendPropertyChanging();
                    this._OrderID = value;
                    this.SendPropertyChanged("OrderID");
                    this.OnOrderIDChanged();
                }
            }
        }
        
        [Column(Storage="_CustomerID", DbType="NChar(5)")]
        public string CustomerID
        {
            get
            {
                return this._CustomerID;
            }
            set
            {
                if ((this._CustomerID != value))
                {
                    this.OnCustomerIDChanging(value);
                    this.SendPropertyChanging();
                    this._CustomerID = value;
                    this.SendPropertyChanged("CustomerID");
                    this.OnCustomerIDChanged();
                }
            }
        }
        
        [Column(Storage="_EmployeeID", DbType="Int")]
        public System.Nullable<int> EmployeeID
        {
            get
            {
                return this._EmployeeID;
            }
            set
            {
                if ((this._EmployeeID != value))
                {
                    this.OnEmployeeIDChanging(value);
                    this.SendPropertyChanging();
                    this._EmployeeID = value;
                    this.SendPropertyChanged("EmployeeID");
                    this.OnEmployeeIDChanged();
                }
            }
        }
        
        [Column(Storage="_OrderDate", DbType="DateTime")]
        public System.Nullable<System.DateTime> OrderDate
        {
            get
            {
                return this._OrderDate;
            }
            set
            {
                if ((this._OrderDate != value))
                {
                    this.OnOrderDateChanging(value);
                    this.SendPropertyChanging();
                    this._OrderDate = value;
                    this.SendPropertyChanged("OrderDate");
                    this.OnOrderDateChanged();
                }
            }
        }
        
        [Column(Storage="_RequiredDate", DbType="DateTime")]
        public System.Nullable<System.DateTime> RequiredDate
        {
            get
            {
                return this._RequiredDate;
            }
            set
            {
                if ((this._RequiredDate != value))
                {
                    this.OnRequiredDateChanging(value);
                    this.SendPropertyChanging();
                    this._RequiredDate = value;
                    this.SendPropertyChanged("RequiredDate");
                    this.OnRequiredDateChanged();
                }
            }
        }
        
        [Column(Storage="_ShippedDate", DbType="DateTime")]
        public System.Nullable<System.DateTime> ShippedDate
        {
            get
            {
                return this._ShippedDate;
            }
            set
            {
                if ((this._ShippedDate != value))
                {
                    this.OnShippedDateChanging(value);
                    this.SendPropertyChanging();
                    this._ShippedDate = value;
                    this.SendPropertyChanged("ShippedDate");
                    this.OnShippedDateChanged();
                }
            }
        }
        
        [Column(Storage="_ShipVia", DbType="Int")]
        public System.Nullable<int> ShipVia
        {
            get
            {
                return this._ShipVia;
            }
            set
            {
                if ((this._ShipVia != value))
                {
                    this.OnShipViaChanging(value);
                    this.SendPropertyChanging();
                    this._ShipVia = value;
                    this.SendPropertyChanged("ShipVia");
                    this.OnShipViaChanged();
                }
            }
        }
        
        [Column(Storage="_Freight", DbType="Money")]
        public System.Nullable<decimal> Freight
        {
            get
            {
                return this._Freight;
            }
            set
            {
                if ((this._Freight != value))
                {
                    this.OnFreightChanging(value);
                    this.SendPropertyChanging();
                    this._Freight = value;
                    this.SendPropertyChanged("Freight");
                    this.OnFreightChanged();
                }
            }
        }
        
        [Column(Storage="_ShipName", DbType="NVarChar(40)")]
        public string ShipName
        {
            get
            {
                return this._ShipName;
            }
            set
            {
                if ((this._ShipName != value))
                {
                    this.OnShipNameChanging(value);
                    this.SendPropertyChanging();
                    this._ShipName = value;
                    this.SendPropertyChanged("ShipName");
                    this.OnShipNameChanged();
                }
            }
        }
        
        [Column(Storage="_ShipAddress", DbType="NVarChar(60)")]
        public string ShipAddress
        {
            get
            {
                return this._ShipAddress;
            }
            set
            {
                if ((this._ShipAddress != value))
                {
                    this.OnShipAddressChanging(value);
                    this.SendPropertyChanging();
                    this._ShipAddress = value;
                    this.SendPropertyChanged("ShipAddress");
                    this.OnShipAddressChanged();
                }
            }
        }
        
        [Column(Storage="_ShipCity", DbType="NVarChar(15)")]
        public string ShipCity
        {
            get
            {
                return this._ShipCity;
            }
            set
            {
                if ((this._ShipCity != value))
                {
                    this.OnShipCityChanging(value);
                    this.SendPropertyChanging();
                    this._ShipCity = value;
                    this.SendPropertyChanged("ShipCity");
                    this.OnShipCityChanged();
                }
            }
        }
        
        [Column(Storage="_ShipRegion", DbType="NVarChar(15)")]
        public string ShipRegion
        {
            get
            {
                return this._ShipRegion;
            }
            set
            {
                if ((this._ShipRegion != value))
                {
                    this.OnShipRegionChanging(value);
                    this.SendPropertyChanging();
                    this._ShipRegion = value;
                    this.SendPropertyChanged("ShipRegion");
                    this.OnShipRegionChanged();
                }
            }
        }
        
        [Column(Storage="_ShipPostalCode", DbType="NVarChar(10)")]
        public string ShipPostalCode
        {
            get
            {
                return this._ShipPostalCode;
            }
            set
            {
                if ((this._ShipPostalCode != value))
                {
                    this.OnShipPostalCodeChanging(value);
                    this.SendPropertyChanging();
                    this._ShipPostalCode = value;
                    this.SendPropertyChanged("ShipPostalCode");
                    this.OnShipPostalCodeChanged();
                }
            }
        }
        
        [Column(Storage="_ShipCountry", DbType="NVarChar(15)")]
        public string ShipCountry
        {
            get
            {
                return this._ShipCountry;
            }
            set
            {
                if ((this._ShipCountry != value))
                {
                    this.OnShipCountryChanging(value);
                    this.SendPropertyChanging();
                    this._ShipCountry = value;
                    this.SendPropertyChanged("ShipCountry");
                    this.OnShipCountryChanged();
                }
            }
        }
        
        [Association(Name="Order_Order_Detail", Storage="_Order_Details", OtherKey="OrderID")]
        public EntitySet<Order_Detail> Order_Details
        {
            get
            {
                return this._Order_Details;
            }
            set
            {
                this._Order_Details.Assign(value);
            }
        }
        
        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_Order_Details(Order_Detail entity)
        {
            this.SendPropertyChanging();
            entity.Order = this;
            this.SendPropertyChanged("Order_Details");
        }
        
        private void detach_Order_Details(Order_Detail entity)
        {
            this.SendPropertyChanging();
            entity.Order = null;
            this.SendPropertyChanged("Order_Details");
        }
    }
    
    [Table(Name="dbo.[Order Details]")]
    public partial class Order_Detail : INotifyPropertyChanging, INotifyPropertyChanged
    {
        
        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        
        private int _OrderID;
        
        private int _ProductID;
        
        private decimal _UnitPrice;
        
        private short _Quantity;
        
        private float _Discount;
        
        private EntityRef<Order> _Order;
        
    Extensibility Method Definitions#region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate();
    partial void OnCreated();
    partial void OnOrderIDChanging(int value);
    partial void OnOrderIDChanged();
    partial void OnProductIDChanging(int value);
    partial void OnProductIDChanged();
    partial void OnUnitPriceChanging(decimal value);
    partial void OnUnitPriceChanged();
    partial void OnQuantityChanging(short value);
    partial void OnQuantityChanged();
    partial void OnDiscountChanging(float value);
    partial void OnDiscountChanged();
    #endregion
        
        public Order_Detail()
        {
            OnCreated();
            this._Order = default(EntityRef<Order>);
        }
        
        [Column(Storage="_OrderID", DbType="Int NOT NULL", IsPrimaryKey=true)]
        public int OrderID
        {
            get
            {
                return this._OrderID;
            }
            set
            {
                if ((this._OrderID != value))
                {
                    if (this._Order.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.OnOrderIDChanging(value);
                    this.SendPropertyChanging();
                    this._OrderID = value;
                    this.SendPropertyChanged("OrderID");
                    this.OnOrderIDChanged();
                }
            }
        }
        
        [Column(Storage="_ProductID", DbType="Int NOT NULL", IsPrimaryKey=true)]
        public int ProductID
        {
            get
            {
                return this._ProductID;
            }
            set
            {
                if ((this._ProductID != value))
                {
                    this.OnProductIDChanging(value);
                    this.SendPropertyChanging();
                    this._ProductID = value;
                    this.SendPropertyChanged("ProductID");
                    this.OnProductIDChanged();
                }
            }
        }
        
        [Column(Storage="_UnitPrice", DbType="Money NOT NULL")]
        public decimal UnitPrice
        {
            get
            {
                return this._UnitPrice;
            }
            set
            {
                if ((this._UnitPrice != value))
                {
                    this.OnUnitPriceChanging(value);
                    this.SendPropertyChanging();
                    this._UnitPrice = value;
                    this.SendPropertyChanged("UnitPrice");
                    this.OnUnitPriceChanged();
                }
            }
        }
        
        [Column(Storage="_Quantity", DbType="SmallInt NOT NULL")]
        public short Quantity
        {
            get
            {
                return this._Quantity;
            }
            set
            {
                if ((this._Quantity != value))
                {
                    this.OnQuantityChanging(value);
                    this.SendPropertyChanging();
                    this._Quantity = value;
                    this.SendPropertyChanged("Quantity");
                    this.OnQuantityChanged();
                }
            }
        }
        
        [Column(Storage="_Discount", DbType="Real NOT NULL")]
        public float Discount
        {
            get
            {
                return this._Discount;
            }
            set
            {
                if ((this._Discount != value))
                {
                    this.OnDiscountChanging(value);
                    this.SendPropertyChanging();
                    this._Discount = value;
                    this.SendPropertyChanged("Discount");
                    this.OnDiscountChanged();
                }
            }
        }
        
        [Association(Name="Order_Order_Detail", Storage="_Order", ThisKey="OrderID", IsForeignKey=true)]
        public Order Order
        {
            get
            {
                return this._Order.Entity;
            }
            set
            {
                Order previousValue = this._Order.Entity;
                if (((previousValue != value) 
                            || (this._Order.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging();
                    if ((previousValue != null))
                    {
                        this._Order.Entity = null;
                        previousValue.Order_Details.Remove(this);
                    }
                    this._Order.Entity = value;
                    if ((value != null))
                    {
                        value.Order_Details.Add(this);
                        this._OrderID = value.OrderID;
                    }
                    else
                    {
                        this._OrderID = default(int);
                    }
                    this.SendPropertyChanged("Order");
                }
            }
        }
        
        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));
            }
        }
    }

 

本节介绍了O/R Designer的基本用法,下节讲一些比较高级的用法。O/R Designer相对与sqlmetal的好处就可以设计类的继承关系(下节再讲),而sqlmetal 相对于O/R Designer是可以一次性抽提所有表的信息,快速便捷。而且sqlmetal支持一些O/R Designer无法支持的信息提取。

<script type="text/javascript"> if ($ != jQuery) { $ = jQuery.noConflict(); } </script>

  • 大小: 13 KB
  • 大小: 41.5 KB
  • 大小: 10.9 KB
  • 大小: 36.8 KB
  • 大小: 38.5 KB
  • 大小: 35.3 KB
  • 大小: 35.4 KB
  • 大小: 21.4 KB
分享到:
评论

相关推荐

    C# 3.0 入门系列

    在这个入门系列中,我们将深入探讨C# 3.0的关键概念,帮助初学者快速掌握这门强大的编程语言。 1. **匿名方法与Lambda表达式**: C# 3.0 引入了匿名方法,它允许我们在不定义单独的方法的情况下,直接在需要的地方...

    -----------C#3.0设计模式-------

    在C# 3.0中,设计模式的应用与之前的版本相比有了新的特点,尤其是引入了语言特性如LINQ(Language Integrated Query)和匿名方法,这些新特性为设计模式的实现提供了更简洁的语法。 1. 工厂模式:在C# 3.0中,工厂...

    C#3.0(包括Linq和Lambda)

    总的来说,通过学习"C#3.0(包括Linq和Lambda)",开发者可以掌握现代C#编程的核心技能,无论是在日常开发还是在处理复杂的数据查询场景中,都能游刃有余。这个视频教程结合PDF资料,将帮助你深入理解这些概念,并...

    C#_3.0_LinQ入门系列

    ### C# 3.0与LINQ:深入理解与应用 #### 一、LINQ概述 **Language Integrated Query (LINQ)**,即语言集成查询,是Microsoft在.NET Framework 3.5和C# 3.0中引入的一项重大创新。LINQ提供了一种统一的方式来查询...

    c#3.0入门经典教程

    总结来说,C# 3.0入门教程会涵盖这些核心概念,通过学习,你可以掌握C#语言的基础,并能够利用LINQ进行高效的数据操作,为后续深入学习C# 4.0及以上版本打下坚实基础。通过实践,你会逐渐熟悉并爱上这种强大而优雅的...

    C# 3.0 LinQ入门系列

    C# 3.0 林林总总的 LINQ(Language Integrated Query,语言集成查询)是一个强大的数据查询工具,它允许开发者在编程语言中直接编写SQL风格的查询,极大地提高了代码的可读性和效率。这个入门系列将逐步引导你了解并...

    Pro C# 3.0 And Linq

    LINQ是C# 3.0中最引人注目的特性之一,它将SQL风格的查询功能直接融入到C#语言中,允许开发者以声明式的方式处理数据,无论是在内存中还是数据库中。LINQ提供了一种统一的数据访问方式,支持多种数据源,包括数组、...

    subsonic-SubSonic-3.0-3.0.0.4-89-g18114a1源码

    标题中的 "subsonic-SubSonic-3.0-3.0.0.4-89-g18114a1" 指的是SubSonic 3.0的一个特定版本,具体是3.0.0.4版,89代表的是在Git仓库中的提交次数,而"g18114a1"则是该版本的Git哈希值,通常用于追踪源代码的具体变更...

    C#3.0_与_LINQ PPT

    C# 3.0 和 LINQ(Language Integrated Query,语言集成查询)是.NET Framework 3.0中的重要特性,它们极大地增强了C#编程语言的功能,尤其是处理数据的能力。本资源包含的"Visual C# 3.0_与_LINQ.ppt"是一个关于这个...

    C# 3.0 锐利体验系列课程(1)

    在“C# 3.0 锐利体验系列课程(1)”中,"概览"部分将为学员提供一个整体的入门指南,介绍上述关键特性的概念和基本用法。通过这一部分的学习,开发者将能够对C# 3.0的主要改进有一个全面的理解,为进一步深入学习打下...

    C# 3.0 锐利体验系列课程

    《C# 3.0 锐利体验系列课程》是一套深入浅出的视频教程,专为想要深入了解和熟练运用C# 3.0中Linq(Language Integrated Query,语言集成查询)和Lambda表达式的开发者设计。这个系列课程通过丰富的实例和详尽的解释...

    C#3.0和LINQ(英文版PPT)

    C# 3.0是微软对C#编程语言的一次重大升级,引入了许多新特性,这些新特性极大地提升了代码的可读性和开发效率。其中最重要的一个改进就是对Language Integrated Query (LINQ)的支持,它是一种将查询表达式内置于语言...

    C# 3.0 锐利体验系列课程(3):查询表达式LINQ(1).rar

    这个压缩包文件“C# 3.0 锐利体验系列课程(3):查询表达式LINQ(1).rar”显然是一份关于C# 3.0中LINQ查询表达式的教学资源,旨在帮助学习者深入理解并掌握这一强大的数据查询工具。 LINQ是一种在C#中进行数据查询的...

    C#3.0 & LINQ.ppt

    本文件主要介绍了C# 3.0的新特性以及如何使用LINQ。 1. **局部变量类型**:在C# 2.0中,声明变量时必须指定其类型,如`int x = 5;`。C# 3.0引入了`var`关键字,允许编译器推断变量类型。例如,`var x = 5;`,编译器...

    C#3.0 in a nutshell

    《C# 3.0 in a Nutshell》一书详细介绍了这些特性和更多内容,包括类型系统、面向对象编程、异常处理、并发编程、垃圾回收以及.NET Framework的其他重要组件。通过阅读这本书,开发者能够深入了解C# 3.0的全貌,从而...

    C# 3.0 锐利体验系列课程(4):查询表达式LINQ(2).rar

    本课程“C# 3.0 锐利体验系列课程(4):查询表达式LINQ(2)”将深入探讨查询表达式的使用和原理,帮助开发者更好地利用这一强大的数据查询工具。 LINQ是C#中一种革命性的编程模式,它允许程序员使用一致的语法来查询...

    C# 3.0:A Beginner’s Guide

    本书作为初学者的指南,详细解释了这些新特性,包括但不限于自动实现属性、匿名类型、扩展方法、查询表达式、动态调用等,这些都是C# 3.0版本中最吸引人的特性之一。 ### 自动实现属性 自动实现属性是C# 3.0新增的...

Global site tag (gtag.js) - Google Analytics