【发布时间】:2026-01-04 15:50:01
【问题描述】:
我正在尝试对现有项目进行更改,并且我在解决方案中发现了一个充满生成类的项目。
问题是,这里没有人能告诉我是什么产生了它们,所以我几乎只能在这里粘贴其中一个类,并希望有人能够告诉我它们来自哪里。
我正在研究的解决方案使用 Expression Blend 3 和 Visual Studio 2008。不知道这是否相关,但我试图提供尽可能多的信息......以及出现的这个类在它自己的文件中,有一个“SPResults”文件,其中包含大约 5000 行这种类型的访问器类。不太清楚为什么 EndCustomer 在它自己的文件中......
据我所知,该程序链接到的其中一个数据库中有一个存储过程,该 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
这部分是 EndCustomer 类本身。
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 上的一些晦涩难懂的软件。有什么线索吗?
【问题讨论】:
标签: .net sql-server vb.net visual-studio-2008 xaml