我正在使用TPT建模并手工编写EDMX,因为我们的数据模型比设计人员可以支持的复杂得多。我的模型包含一个ProjectObject,它有一个依赖对象名称Project。当我使用Linq to SQL查询ProjectObject.OfType(Project)时,我接收从ProjectObject继承的所有字段中的返回数据,但是仅在Project中的字段中没有数据。我运行了一个SQL Server跟踪并捕获了实际的SQL并使用SSMS运行它并在那里返回数据,所以我相对肯定数据被传回,但它似乎在EF的某个地方丢失了。在我的模型中,一切似乎都没问题,但是。 。 。
SSDL
<EntityContainer Name="Insight_ModelStoreContainer">
<EntitySet Name="Project" EntityType="Insight_Model.Store.Project" store:Type="Views" store:Schema="dbo" store:Name="vw_insight_Project">
<DefiningQuery>
SELECT
[vw_insight_Project].[ProjNum] AS [ProjNum],
[vw_insight_Project].[ID] AS [ID],
[vw_insight_Project].[RefID] AS [RefID],
[vw_insight_Project].[Name] AS [Name],
[vw_insight_Project].[TypeID] AS [TypeID],
[vw_insight_Project].[ClientUserID] AS [ClientUserID],
[vw_insight_Project].[ClientCompanyLocID] AS [ClientCompanyLocID],
[vw_insight_Project].[ClientCompanyID] AS [ClientCompanyID],
[vw_insight_Project].[CustomerUserID] AS [CustomerUserID],
[vw_insight_Project].[CustomerCompanyLocID] AS [CustomerCompanyLocID],
[vw_insight_Project].[CustomerCompanyID] AS [CustomerCompanyID],
[vw_insight_Project].[DistributorUserID] AS [DistributorUserID],
[vw_insight_Project].[DistributorCompanyLocID] AS [DistributorCompanyLocID],
[vw_insight_Project].[DistributorCompanyID] AS [DistributorCompanyID],
[vw_insight_Project].[TechUserID] AS [TechUserID],
[vw_insight_Project].[TechCompanyLocID] AS [TechCompanyLocID],
[vw_insight_Project].[TechCompanyID] AS [TechCompanyID],
[vw_insight_Project].[EmployeeUserID] AS [EmployeeUserID],
[vw_insight_Project].[EmployeeCompanyLocID] AS [EmployeeCompanyLocID],
[vw_insight_Project].[EmployeeCompanyID] AS [EmployeeCompanyID],
[vw_insight_Project].[VendorUserID] AS [VendorUserID],
[vw_insight_Project].[VendorCompanyLocID] AS [VendorCompanyLocID],
[vw_insight_Project].[VendorCompanyID] AS [VendorCompanyID],
[vw_insight_Project].[CreateDate] AS [CreateDate],
[vw_insight_Project].[ModifyDate] AS [ModifyDate],
[vw_insight_Project].[CreateUID] AS [CreateUID],
[vw_insight_Project].[ModifyUID] AS [ModifyUID]
FROM [dbo].[vw_insight_Project] AS [vw_insight_Project]
</DefiningQuery>
</EntitySet>
</EntityContainer>
<EntityType Name="Project">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ProjNum" Type="int" Nullable="false"/>
<Property Name="ID" Type="int" Nullable="false" />
<Property Name="RefID" Type="int" />
<Property Name="Name" Type="varchar" Nullable="false" MaxLength="50" />
<Property Name="TypeID" Type="int" />
<Property Name="ClientUserID" Type="int" Nullable="true" />
<Property Name="ClientCompanyLocID" Type="int" Nullable="true" />
<Property Name="ClientCompanyID" Type="int" Nullable="true" />
<Property Name="CustomerUserID" Type="int" Nullable="true" />
<Property Name="CustomerCompanyLocID" Type="int" Nullable="true" />
<Property Name="CustomerCompanyID" Type="int" Nullable="true" />
<Property Name="DistributorUserID" Type="int" Nullable="true" />
<Property Name="DistributorCompanyLocID" Type="int" Nullable="true" />
<Property Name="DistributorCompanyID" Type="int" Nullable="true" />
<Property Name="TechUserID" Type="int" Nullable="true" />
<Property Name="TechCompanyLocID" Type="int" Nullable="true" />
<Property Name="TechCompanyID" Type="int" Nullable="true" />
<Property Name="EmployeeUserID" Type="int" />
<Property Name="EmployeeCompanyLocID" Type="int" Nullable="true" />
<Property Name="EmployeeCompanyID" Type="int" Nullable="true" />
<Property Name="VendorUserID" Type="int" Nullable="true" />
<Property Name="VendorCompanyLocID" Type="int" Nullable="true" />
<Property Name="VendorCompanyID" Type="int" Nullable="true" />
<Property Name="CreateDate" Type="date" Nullable="false" />
<Property Name="ModifyDate" Type="date" Nullable="false" />
<Property Name="CreateUID" Type="int" Nullable="false" />
<Property Name="ModifyUID" Type="int" Nullable="false" />
</EntityType>
CSDL
<EntityContainer Name="Insight_Entities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="ProjectObjects" EntityType="Insight_Model.ProjectObject" />
</EntityContainer>
<EntityType Name="ProjectObject" Abstract="true">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Type="Int32" Name="ProjNum" Nullable="false" />
<Property Type="Int32" Name="ID" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Type="Int32" Name="RefID" />
<Property Type="String" Name="Name" Nullable="false" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Type="Int32" Name="TypeID" Nullable="false" />
<Property Type="DateTime" Name="CreateDate" Nullable="false" />
<Property Type="DateTime" Name="ModifyDate" Nullable="false" />
<Property Type="Int32" Name="CreateUID" Nullable="false" />
<Property Type="Int32" Name="ModifyUID" Nullable="false" />
<NavigationProperty Name="UserRoles" Relationship="Insight_Model.UserRoleProjectObject" FromRole="ProjectObject" ToRole="UserRole" />
<NavigationProperty Name="ProjectObjectComments" Relationship="Insight_Model.ProjectObjectComments" FromRole="ProjectObject" ToRole="CommentProjectObject" />
<NavigationProperty Name="ProjectObjectFollowUps" Relationship="Insight_Model.ProjectObjectFollowUps" FromRole="ProjectObject" ToRole="FollowUpProjectObject" />
<NavigationProperty Name="ProjectObjectAttachments" Relationship="Insight_Model.ProjectObjectAttachments" FromRole="ProjectObject" ToRole="AttachmentProjectObject" />
<NavigationProperty Name="ProjectObjectType" Relationship="Insight_Model.ProjectObjectTypeAttributeLookup" FromRole="ProjectObject" ToRole="AttributeLookup" />
</EntityType>
<EntityType Name="Project" BaseType="Insight_Model.ProjectObject" >
<Property Type="Int32" Name="ClientUserID" />
<Property Type="Int32" Name="ClientCompanyLocID" />
<Property Type="Int32" Name="ClientCompanyID" />
<Property Type="Int32" Name="CustomerUserID" />
<Property Type="Int32" Name="CustomerCompanyLocID" />
<Property Type="Int32" Name="CustomerCompanyID" />
<Property Type="Int32" Name="DistributorUserID" />
<Property Type="Int32" Name="DistributorCompanyLocID" />
<Property Type="Int32" Name="DistributorCompanyID" />
<Property Type="Int32" Name="TechUserID" />
<Property Type="Int32" Name="TechCompanyLocID" />
<Property Type="Int32" Name="TechCompanyID" />
<Property Type="Int32" Name="EmployeeUserID" />
<Property Type="Int32" Name="EmployeeCompanyLocID" />
<Property Type="Int32" Name="EmployeeCompanyID" />
<Property Type="Int32" Name="VendorUserID" />
<Property Type="Int32" Name="VendorCompanyLocID" />
<Property Type="Int32" Name="VendorCompanyID" />
<NavigationProperty Name="ClientUserRole" Relationship="Insight_Model.ProjectClientUserRole" FromRole="Project" ToRole="UserRole" />
<NavigationProperty Name="CustomerUserRole" Relationship="Insight_Model.ProjectCustomerUserRole" FromRole="Project" ToRole="UserRole" />
<NavigationProperty Name="DistributorUserRole" Relationship="Insight_Model.ProjectDistributorUserRole" FromRole="Project" ToRole="UserRole" />
<NavigationProperty Name="TechUserRole" Relationship="Insight_Model.ProjectTechUserRole" FromRole="Project" ToRole="UserRole" />
<NavigationProperty Name="EmployeeUserRole" Relationship="Insight_Model.ProjectEmployeeUserRole" FromRole="Project" ToRole="UserRole" />
<NavigationProperty Name="VendorUserRole" Relationship="Insight_Model.ProjectVendorUserRole" FromRole="Project" ToRole="UserRole" />
<NavigationProperty Name="ClientCompany" Relationship="Insight_Model.ProjectClientCompany" FromRole="Project" ToRole="Company" />
<NavigationProperty Name="CustomerCompany" Relationship="Insight_Model.ProjectCustomerCompany" FromRole="Project" ToRole="Company" />
<NavigationProperty Name="DistributorCompany" Relationship="Insight_Model.ProjectDistributorCompany" FromRole="Project" ToRole="Company" />
<NavigationProperty Name="TechCompany" Relationship="Insight_Model.ProjectTechCompany" FromRole="Project" ToRole="Company" />
<NavigationProperty Name="EmployeeCompany" Relationship="Insight_Model.ProjectEmployeeCompany" FromRole="Project" ToRole="Company" />
<NavigationProperty Name="VendorCompany" Relationship="Insight_Model.ProjectVendorCompany" FromRole="Project" ToRole="Company" />
<NavigationProperty Name="ClientCompanyLoc" Relationship="Insight_Model.ProjectClientCompanyLoc" FromRole="Project" ToRole="CompanyLoc" />
<NavigationProperty Name="CustomerCompanyLoc" Relationship="Insight_Model.ProjectCustomerCompanyLoc" FromRole="Project" ToRole="CompanyLoc" />
<NavigationProperty Name="DistributorCompanyLoc" Relationship="Insight_Model.ProjectDistributorCompanyLoc" FromRole="Project" ToRole="CompanyLoc" />
<NavigationProperty Name="TechCompanyLoc" Relationship="Insight_Model.ProjectTechCompanyLoc" FromRole="Project" ToRole="CompanyLoc" />
<NavigationProperty Name="EmployeeCompanyLoc" Relationship="Insight_Model.ProjectEmployeeCompanyLoc" FromRole="Project" ToRole="CompanyLoc" />
<NavigationProperty Name="VendorCompanyLoc" Relationship="Insight_Model.ProjectVendorCompanyLoc" FromRole="Project" ToRole="CompanyLoc" />
</EntityType>
CSDL
<EntitySetMapping Name="ProjectObjects">
<EntityTypeMapping TypeName="Insight_Model.Project" >
<MappingFragment StoreEntitySet="Project">
<ScalarProperty Name="ProjNum" ColumnName="ProjNum" />
<ScalarProperty Name="RefID" ColumnName="RefID" />
<ScalarProperty Name="ID" ColumnName="ID" />
<ScalarProperty Name="Name" ColumnName="Name" />
<ScalarProperty Name="TypeID" ColumnName="TypeID" />
<ScalarProperty Name="CreateUID" ColumnName="CreateUID" />
<ScalarProperty Name="ModifyUID" ColumnName="ModifyUID" />
<ScalarProperty Name="CreateDate" ColumnName="CreateDate" />
<ScalarProperty Name="ModifyDate" ColumnName="ModifyDate" />
<ScalarProperty Name="ClientUserID" ColumnName="ClientUserID" />
<ScalarProperty Name="ClientCompanyLocID" ColumnName="ClientCompanyLocID" />
<ScalarProperty Name="ClientCompanyID" ColumnName="ClientCompanyID" />
<ScalarProperty Name="CustomerUserID" ColumnName="CustomerUserID" />
<ScalarProperty Name="CustomerCompanyLocID" ColumnName="CustomerCompanyLocID" />
<ScalarProperty Name="CustomerCompanyID" ColumnName="CustomerCompanyID" />
<ScalarProperty Name="DistributorUserID" ColumnName="DistributorUserID" />
<ScalarProperty Name="DistributorCompanyLocID" ColumnName="DistributorCompanyLocID" />
<ScalarProperty Name="DistributorCompanyID" ColumnName="DistributorCompanyID" />
<ScalarProperty Name="TechUserID" ColumnName="TechUserID" />
<ScalarProperty Name="TechCompanyLocID" ColumnName="TechCompanyLocID" />
<ScalarProperty Name="TechCompanyID" ColumnName="TechCompanyID" />
<ScalarProperty Name="EmployeeUserID" ColumnName="EmployeeUserID" />
<ScalarProperty Name="EmployeeCompanyLocID" ColumnName="EmployeeCompanyLocID" />
<ScalarProperty Name="EmployeeCompanyID" ColumnName="EmployeeCompanyID" />
<ScalarProperty Name="VendorUserID" ColumnName="VendorUserID" />
<ScalarProperty Name="VendorCompanyLocID" ColumnName="VendorCompanyLocID" />
<ScalarProperty Name="VendorCompanyID" ColumnName="VendorCompanyID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
存储数据的POCO
#Region "ProjectObject"
''' <summary>
''' ProjectObject class.
''' </summary>
<Serializable()>
<DataContractAttribute(IsReference:=True)>
<KnownTypeAttribute(GetType(Project))>
<KnownTypeAttribute(GetType(WorkOrder))>
<KnownTypeAttribute(GetType(Survey))>
Partial Public MustInherit Class ProjectObject
#Region "Declarations"
Private _ProjNum As Global.System.Int32
Private _ID As Global.System.Int32
Private _RefID As Nullable(Of Global.System.Int32)
Private _TypeID As Global.System.Int32
Private _Name As Global.System.String
Private _CreateDate As Global.System.DateTime
Private _ModifyDate As Global.System.DateTime
Private _CreateUID As Global.System.Int32
Private _ModifyUID As Global.System.Int32
Private _ParentObject As ProjectObject
Private _UserRoles As ObservableCollection(Of UserRole)
Private _ChildObjects As ICollection(Of ProjectObject)
Private _ProjectObjectAttributes As ICollection(Of ProjectObjectAttribute)
Private _ProjectObjectComments As ObservableCollection(Of CommentProjectObject)
Private _ProjectObjectAttachments As ObservableCollection(Of AttachmentProjectObject)
Private _ProjectObjectFollowUps As IObservable(Of FollowUpProjectObject)
Private _ProjectObjectType As AttributeLookup
#End Region
#Region "Primitive Properties"
#Region "ProjNum"
''' <summary>Project Number.</summary>
<DataMemberAttribute()>
Public Property ProjNum() As Global.System.Int32
Get
Return _ProjNum
End Get
Set(value As Global.System.Int32)
If (_ProjNum <> value) Then
OnProjNumChanging(value)
_ProjNum = value
OnProjNumChanged()
End If
End Set
End Property
Partial Private Sub OnProjNumChanging(value As Global.System.Int32)
End Sub
Partial Private Sub OnProjNumChanged()
End Sub
#End Region
#Region "ID"
''' <summary>
''' Project Object ID.
''' </summary>
<DataMemberAttribute()>
Public Property ID() As Global.System.Int32
Get
Return _ID
End Get
Set(value As Global.System.Int32)
If (_ID <> value) Then
OnIDChanging(value)
_ID = value
OnIDChanged()
End If
End Set
End Property
Partial Private Sub OnIDChanging(value As Global.System.Int32)
End Sub
Partial Private Sub OnIDChanged()
End Sub
#End Region
#Region "RefID"
''' <summary>
''' No Metadata Documentation available.
''' </summary>
<DataMemberAttribute()>
Public Property RefID() As Nullable(Of Global.System.Int32)
Get
Return _RefID
End Get
Set(value As Nullable(Of Global.System.Int32))
OnRefIDChanging(value)
_RefID = value
OnRefIDChanged()
End Set
End Property
Partial Private Sub OnRefIDChanging(value As Nullable(Of Global.System.Int32))
End Sub
Partial Private Sub OnRefIDChanged()
End Sub
#End Region
#Region "Name"
''' <summary>
''' No Metadata Documentation available.
''' </summary>
<DataMemberAttribute()>
Public Property Name() As Global.System.String
Get
Return _Name
End Get
Set(value As Global.System.String)
OnNameChanging(value)
_Name = value
OnNameChanged()
End Set
End Property
Partial Private Sub OnNameChanging(value As Global.System.String)
End Sub
Partial Private Sub OnNameChanged()
End Sub
#End Region
#Region "TypeID"
''' <summary>
''' TypeID.
''' </summary>
<DataMemberAttribute()>
Public Property TypeID() As Global.System.Int32
Get
Return _TypeID
End Get
Set(value As Global.System.Int32)
If (_TypeID <> value) Then
OnTypeIDChanging(value)
_TypeID = value
OnTypeIDChanged()
End If
End Set
End Property
Partial Private Sub OnTypeIDChanging(value As Global.System.Int32)
End Sub
Partial Private Sub OnTypeIDChanged()
End Sub
#End Region
'Remaining primitives removed for brevity.
#End Region
#Region "Navigation Properties"
#Region "ParentObject"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property ParentObject() As ProjectObject
Get
Return _ParentObject
End Get
Set(value As ProjectObject)
_ParentObject = value
End Set
End Property
#End Region
#Region "UserRoles"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property UserRoles() As ObservableCollection(Of UserRole)
Get
Return _UserRoles
End Get
Set(value As ObservableCollection(Of UserRole))
_UserRoles = value
End Set
End Property
#End Region
#Region "ChildObjects"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property ChildObjects() As ICollection(Of ProjectObject)
Get
Return _ChildObjects
End Get
Set(value As ICollection(Of ProjectObject))
_ChildObjects = value
End Set
End Property
#End Region
#Region "ProjectObjectAttributes"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property ProjectObjectAttributes() As ICollection(Of ProjectObjectAttribute)
Get
Return _ProjectObjectAttributes
End Get
Set(value As ICollection(Of ProjectObjectAttribute))
_ProjectObjectAttributes = value
End Set
End Property
#End Region
#Region "ProjectObjectAttachments"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property ProjectObjectAttachments() As IObservable(Of AttachmentProjectObject)
Get
Return _ProjectObjectAttachments
End Get
Set(value As IObservable(Of AttachmentProjectObject))
_ProjectObjectAttachments = value
End Set
End Property
#End Region
#Region "ProjectObjectFollowUps"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property ProjectObjectFollowUps() As IObservable(Of FollowUpProjectObject)
Get
Return _ProjectObjectFollowUps
End Get
Set(value As IObservable(Of FollowUpProjectObject))
_ProjectObjectFollowUps = value
End Set
End Property
#End Region
#Region "ProjectObjectComments"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property ProjectObjectComments() As ObservableCollection(Of CommentProjectObject)
Get
Return _ProjectObjectComments
End Get
Set(value As ObservableCollection(Of CommentProjectObject))
_ProjectObjectComments = value
End Set
End Property
#End Region
#Region "ProjectObjectType"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property ProjectObjectType() As AttributeLookup
Get
Return _ProjectObjectType
End Get
Set(value As AttributeLookup)
_ProjectObjectType = value
End Set
End Property
#End Region
#End Region
End Class
#End Region
<Serializable()>
<DataContractAttribute(IsReference:=True)>
Partial Public Class Project
Inherits ProjectObject
#Region "Declarations"
Private _ProjectID As Global.System.Int32
Private _ClientUserID As Nullable(Of Global.System.Int32)
Private _ClientCompanyLocID As Nullable(Of Global.System.Int32)
Private _ClientCompanyID As Nullable(Of Global.System.Int32)
Private _CustomerUserID As Nullable(Of Global.System.Int32)
Private _CustomerCompanyLocID As Nullable(Of Global.System.Int32)
Private _CustomerCompanyID As Nullable(Of Global.System.Int32)
Private _DistributorUserID As Nullable(Of Global.System.Int32)
Private _DistributorCompanyLocID As Nullable(Of Global.System.Int32)
Private _DistributorCompanyID As Nullable(Of Global.System.Int32)
Private _TechUserID As Nullable(Of Global.System.Int32)
Private _TechCompanyLocID As Nullable(Of Global.System.Int32)
Private _TechCompanyID As Nullable(Of Global.System.Int32)
Private _EmployeeUserID As Nullable(Of Global.System.Int32)
Private _EmployeeCompanyLocID As Nullable(Of Global.System.Int32)
Private _EmployeeCompanyID As Nullable(Of Global.System.Int32)
Private _VendorUserID As Nullable(Of Global.System.Int32)
Private _VendorCompanyLocID As Nullable(Of Global.System.Int32)
Private _VendorCompanyID As Nullable(Of Global.System.Int32)
Private _ClientUserRole As UserRole
Private _CustomerUserRole As UserRole
Private _DistributorUserRole As UserRole
Private _TechUserRole As UserRole
Private _EmployeeUserRole As UserRole
Private _VendorUserRole As UserRole
Private _ClientCompany As Company
Private _CustomerCompany As Company
Private _DistributorCompany As Company
Private _TechCompany As Company
Private _EmployeeCompany As Company
Private _VendorCompany As Company
Private _ClientCompanyLoc As CompanyLoc
Private _CustomerCompanyLoc As CompanyLoc
Private _DistributorCompanyLoc As CompanyLoc
Private _TechCompanyLoc As CompanyLoc
Private _EmployeeCompanyLoc As CompanyLoc
Private _VendorCompanyLoc As CompanyLoc
#End Region
#Region "Primitive Properties"
#Region "ProjectID"
''' <summary>ProjectID.</summary>
<DataMemberAttribute()>
Public Property ProjectID() As Nullable(Of Global.System.Int32)
Get
Return _ProjectID
End Get
Set(value As Nullable(Of Global.System.Int32))
If (_ProjectID <> value) Then
OnProjectIDChanging(value)
_ProjectID = value
OnProjectIDChanged()
End If
End Set
End Property
Partial Private Sub OnProjectIDChanging(value As Nullable(Of Global.System.Int32))
End Sub
Partial Private Sub OnProjectIDChanged()
End Sub
#End Region
#Region "ClientUserID"
''' <summary>ClientUserID.</summary>
<DataMemberAttribute()>
Public Property ClientUserID() As Nullable(Of Global.System.Int32)
Get
Return _ClientUserID
End Get
Set(value As Nullable(Of Global.System.Int32))
If (_ClientUserID <> value) Then
OnClientUserIDChanging(value)
_ClientUserID = value
OnClientUserIDChanged()
End If
End Set
End Property
Partial Private Sub OnClientUserIDChanging(value As Nullable(Of Global.System.Int32))
End Sub
Partial Private Sub OnClientUserIDChanged()
End Sub
#End Region
#Region "ClientCompanyLocID"
''' <summary>ClientCompanyLoc.</summary>
<DataMemberAttribute()>
Public Property ClientCompanyLocID() As Nullable(Of Global.System.Int32)
Get
Return _ClientCompanyLocID
End Get
Set(value As Nullable(Of Global.System.Int32))
If (_ClientCompanyLocID <> value) Then
OnClientCompanyLocIDChanging(value)
_ClientCompanyLocID = value
OnClientCompanyLocIDChanged()
End If
End Set
End Property
Partial Private Sub OnClientCompanyLocIDChanging(value As Nullable(Of Global.System.Int32))
End Sub
Partial Private Sub OnClientCompanyLocIDChanged()
End Sub
#End Region
'Remaining Primitives removed for Brevity
#End Region
#Region "Factory Method"
'Removed for brevity of posting
#End Region
#Region "Navigation Properties"
#Region "CustomerUserRole"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property CustomerUserRole() As UserRole
Get
Return _CustomerUserRole
End Get
Set(value As UserRole)
_CustomerUserRole = value
End Set
End Property
#End Region
#Region "DistributorUserRole"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property DistributorUserRole() As UserRole
Get
Return _DistributorUserRole
End Get
Set(value As UserRole)
_DistributorUserRole = value
End Set
End Property
#End Region
#Region "EmployeeUserRole"
<DataMemberAttribute()>
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
Public Overridable Property EmployeeUserRole() As UserRole
Get
Return _EmployeeUserRole
End Get
Set(value As UserRole)
_EmployeeUserRole = value
End Set
End Property
#End Region
'Remaining navigation properties removed for brevity
#End Region
End Class
答案 0 :(得分:0)
我没有收到数据的原因是因为我正在检查:
If (_ClientCompanyID <> value) Then
每个属性。发生了什么事情是它正在检查是否没有(_ClientCompanyID)不等于1(值),净结果总是为假,因此数据没有存储。
Set(value As Nullable(Of Global.System.Int32))
If (_ClientCompanyID <> value) Then
OnClientCompanyIDChanging(value)
_ClientCompanyID = value
OnClientCompanyIDChanged()
End If
End Set
应该是:
Set(value As Nullable(Of Global.System.Int32))
OnClientCompanyIDChanging(value)
_ClientCompanyID = value
OnClientCompanyIDChanged()
End Set
表示所有可以为空的值。卫生署!经验教训。