Skip to content

Commit

Permalink
ItemInstanceAttribute type is validated. Closes #48.
Browse files Browse the repository at this point in the history
  • Loading branch information
hisystems committed Apr 10, 2012
1 parent 4a1a504 commit 9dc1c85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Attributes/ItemInstanceAttribute.vb
Expand Up @@ -9,6 +9,8 @@
Option Strict On
Option Explicit On

Imports System.Linq

''' --------------------------------------------------------------------------------
''' <summary>
''' Specifies the type of class instance that will represent each database record / object.
Expand All @@ -26,10 +28,14 @@ Public Class ItemInstanceAttribute
Private pobjType As Type

''' <summary>
''' Indicates the
''' Indicates the type that inherits DatabaseObject or implements IDatabaseObject.
''' </summary>
Public Sub New(ByVal objType As Type)

If Not objType.GetInterfaces().Contains(GetType(IDatabaseObject)) Then
Throw New ArgumentException("Type " & objType.FullName & " passed to ItemInstanceAttribute does not implement " & GetType(IDatabaseObject).FullName)
End If

pobjType = objType

End Sub
Expand Down
1 change: 1 addition & 0 deletions Database/ObjectReferenceEarlyBinding.vb
Expand Up @@ -103,6 +103,7 @@ Friend Module ObjectReferenceEarlyBinding

#If DEBUG Then
excludeCollectionTypeNames.Add("DatabaseObjects.UnitTests.ItemInstanceTests+TableWithNoItemInstanceAttribute")
excludeCollectionTypeNames.Add("DatabaseObjects.UnitTests.AttributesInvalidTests+InvalidItemInstanceTypeCollection")
#End If

Return _
Expand Down

0 comments on commit 9dc1c85

Please sign in to comment.