我正在尝试对现有项目进行修改,并且在解决方案中发现了一个充满生成类的项目。
问题是,这里没有人能告诉我是什么生成了它们,所以我基本上只剩下粘贴其中一个类,希望有人能告诉我它们来自哪里。
我正在研究的解决方案使用了ExpressionBlend 3和Visual Studio 2008。不知道,如果这是相关的,但我正在尽我所能提供更多的信息…除了出现在自己文件中的这个类之外,还有一个“spresults”文件,其中包含大约5000行这种类型的访问器类。不太清楚为什么最终客户在自己的文件中…
从我自己的角度来看,这个程序链接到的其中一个数据库中有一个存储过程,该SP的名称是“GetEndCustomers”。然后,有东西创建了一个名为“EndCustomers”的类来表示此过程的返回类型。
第一部分是名为
Database
,返回相关对象的集合。
<FunctionAttribute(Name:="dbo.GetEndCustomers")> _
Public Function GetEndCustomers(<Parameter(Name:="Dummy", DbType:="VarChar(1)")> ByVal Dummy As String) As ISingleResult(Of Data.EndCustomer)
Dim result As IExecuteResult = Me.ExecuteMethodCall(Me, CType(MethodInfo.GetCurrentMethod, MethodInfo), Dummy)
Return CType(result.ReturnValue, ISingleResult(Of Data.EndCustomer))
End Function
这部分是最终客户类本身。
Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.Linq
Imports System.Data.Linq.Mapping
Imports System.Linq
Imports System.Linq.Expressions
Imports System.Reflection
Namespace Data
<Table(Name:="dbo.EndCustomers")> _
Partial Public Class EndCustomer
Implements System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
Private Shared emptyChangingEventArgs As PropertyChangingEventArgs = New PropertyChangingEventArgs(String.Empty)
Private _ID As Byte
Private _Name As String
#Region "Extensibility Method Definitions"
Partial Private Sub OnLoaded()
End Sub
Partial Private Sub OnValidate(ByVal action As System.Data.Linq.ChangeAction)
End Sub
Partial Private Sub OnCreated()
End Sub
Partial Private Sub OnIDChanging(ByVal value As Integer)
End Sub
Partial Private Sub OnIDChanged()
End Sub
Partial Private Sub OnNameChanging(ByVal value As String)
End Sub
Partial Private Sub OnNameChanged()
End Sub
#End Region
Public Sub New()
MyBase.New()
OnCreated()
End Sub
<Column(Storage:="_ID", AutoSync:=AutoSync.OnInsert, DbType:="TinyInt NOT NULL IDENTITY", IsPrimaryKey:=True, IsDbGenerated:=True)> _
Public Property ID() As Byte
Get
Return Me._ID
End Get
Set(ByVal value As Byte)
If ((Me._ID = value) _
= False) Then
Me.OnIDChanging(value)
Me.SendPropertyChanging()
Me._ID = value
Me.SendPropertyChanged("ID")
Me.OnIDChanged()
End If
End Set
End Property
<Column(Storage:="_Name", DbType:="VarChar(40) NOT NULL", CanBeNull:=False)> _
Public Property Name() As String
Get
Return Me._Name
End Get
Set(ByVal value As String)
If (String.Equals(Me._Name, value) = False) Then
Me.OnNameChanging(value)
Me.SendPropertyChanging()
Me._Name = value
Me.SendPropertyChanged("Name")
Me.OnNameChanged()
End If
End Set
End Property
Public Event PropertyChanging As PropertyChangingEventHandler Implements System.ComponentModel.INotifyPropertyChanging.PropertyChanging
Public Event PropertyChanged As PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Protected Overridable Sub SendPropertyChanging()
If ((Me.PropertyChangingEvent Is Nothing) _
= False) Then
RaiseEvent PropertyChanging(Me, emptyChangingEventArgs)
End If
End Sub
Protected Overridable Sub SendPropertyChanged(ByVal propertyName As [String])
If ((Me.PropertyChangedEvent Is Nothing) _
= False) Then
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
End If
End Sub
End Class
End Namespace
所以,是的,有人能告诉我什么被用来生成这个类吗?可能是在Visual Studio、Expression Blend、SQL Server Management Studio中,或者是一些我甚至没有注意到的模糊软件在PC上。有什么线索吗?