5楼: 你可以参看下微软提供的API。 System.Data.SqlClient.SqlConnection 文件下都是定义,没有具体的实现,而我们能直接new SqlConnection 然后就直接使用它的方法。 // 摘要: // Represents an open connection to a SQL Server database. This class cannot // be inherited. [DefaultEvent("InfoMessage")] public sealed class SqlConnection : DbConnection, ICloneable { // 摘要: // Initializes a new instance of the System.Data.SqlClient.SqlConnection class. public SqlConnection(); // // 摘要: // Initializes a new instance of the System.Data.SqlClient.SqlConnection class // when given a string that contains the connection string. // // 参数: // connectionString: // The connection used to open the SQL Server database. public SqlConnection(string connectionString); // 摘要: // Gets or sets the string used to open a SQL Server database. // // 返回结果: // The connection string that includes the source database name, and other parameters // needed to establish the initial connection. The default value is an empty // string. // // 异常: // System.ArgumentException: // An invalid connection string argument has been supplied, or a required connection // string argument has not been supplied. [DefaultValue("")] [ResDescription("SqlConnection_ConnectionString")] [RecommendedAsConfigurable(true)] [RefreshProperties(RefreshProperties.All)] [ResCategory("DataCategory_Data")] [Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlConnectionStringEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public override string ConnectionString { get; set; } // // 摘要: // Gets the time to wait while trying to establish a connection before terminating // the attempt and generating an error. // // 返回结果: // The time (in seconds) to wait for a connection to open. The default value // is 15 seconds. // // 异常: // System.ArgumentException: // The value set is less than 0. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [ResDescription("SqlConnection_ConnectionTimeout")] public override int ConnectionTimeout { get; } // // 摘要: // Gets the name of the current database or the database to be used after a // connection is opened. // // 返回结果: // The name of the current database or the name of the database to be used after // a connection is opened. The default value is an empty string. [ResDescription("SqlConnection_Database")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public override string Database { get; } // // 摘要: // Gets the name of the instance of SQL Server to which to connect. // // 返回结果: // The name of the instance of SQL Server to which to connect. The default value // is an empty string. [Browsable(true)] [ResDescription("SqlConnection_DataSource")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public override string DataSource { get; }
public class OrderS { public OrderS();//这里自己把自己写进来了 public void GetOrderNO(string no); public bool HasOrder(string usercode, string enterName); public int GetTaskCount(string UserId); }} 虽然没有实例化,但是在你写的类里面已经把自己包括进去了, 自己=new 自己,有什么不可以?真搞不懂你,看代码都不看仔细!
你可以参看下微软提供的API。
System.Data.SqlClient.SqlConnection
文件下都是定义,没有具体的实现,而我们能直接new SqlConnection
然后就直接使用它的方法。
// 摘要:
// Represents an open connection to a SQL Server database. This class cannot
// be inherited.
[DefaultEvent("InfoMessage")]
public sealed class SqlConnection : DbConnection, ICloneable
{
// 摘要:
// Initializes a new instance of the System.Data.SqlClient.SqlConnection class.
public SqlConnection();
//
// 摘要:
// Initializes a new instance of the System.Data.SqlClient.SqlConnection class
// when given a string that contains the connection string.
//
// 参数:
// connectionString:
// The connection used to open the SQL Server database.
public SqlConnection(string connectionString); // 摘要:
// Gets or sets the string used to open a SQL Server database.
//
// 返回结果:
// The connection string that includes the source database name, and other parameters
// needed to establish the initial connection. The default value is an empty
// string.
//
// 异常:
// System.ArgumentException:
// An invalid connection string argument has been supplied, or a required connection
// string argument has not been supplied.
[DefaultValue("")]
[ResDescription("SqlConnection_ConnectionString")]
[RecommendedAsConfigurable(true)]
[RefreshProperties(RefreshProperties.All)]
[ResCategory("DataCategory_Data")]
[Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlConnectionStringEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public override string ConnectionString { get; set; }
//
// 摘要:
// Gets the time to wait while trying to establish a connection before terminating
// the attempt and generating an error.
//
// 返回结果:
// The time (in seconds) to wait for a connection to open. The default value
// is 15 seconds.
//
// 异常:
// System.ArgumentException:
// The value set is less than 0.
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[ResDescription("SqlConnection_ConnectionTimeout")]
public override int ConnectionTimeout { get; }
//
// 摘要:
// Gets the name of the current database or the database to be used after a
// connection is opened.
//
// 返回结果:
// The name of the current database or the name of the database to be used after
// a connection is opened. The default value is an empty string.
[ResDescription("SqlConnection_Database")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public override string Database { get; }
//
// 摘要:
// Gets the name of the instance of SQL Server to which to connect.
//
// 返回结果:
// The name of the instance of SQL Server to which to connect. The default value
// is an empty string.
[Browsable(true)]
[ResDescription("SqlConnection_DataSource")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public override string DataSource { get; }
里的具体的操作那我怎么能看到?
public class OrderS
{
public OrderS();//这里自己把自己写进来了 public void GetOrderNO(string no);
public bool HasOrder(string usercode, string enterName);
public int GetTaskCount(string UserId);
}}
虽然没有实例化,但是在你写的类里面已经把自己包括进去了,
自己=new 自己,有什么不可以?真搞不懂你,看代码都不看仔细!
这个东西不是写出来的,你可以建一个类库工程,然后写好类,在编译之,然后将类库的编译输出文件
xxx.dll(注意是文件,而不是类库工程本身),在另外的工程中引用。然后那个工程中点击你在第一个工程中给出的类名,就可以看到你需要的东西了
你把定义好的元数据怎么和将要打包的dll合并到dll中?