@ -43,6 +43,25 @@ Namespace Framework.Provider
End If
End Function
Public Function GetHandle ( name As String ) As GetLinqResource
Dim entry As TypeEntry = Find ( name )
Dim assm As Assembly = entry . LoadAssembly
Dim type = assm . GetType ( entry . DeclaringType )
Dim method As MethodInfo = type . GetMethod ( entry . Func , types : = { GetType ( String ) } )
Dim [ delegate ] As New __delegateProvider With { . method = method }
Dim handle As GetLinqResource = AddressOf [ delegate ] . GetLinqResource
Return handle
End Function
Private Class __delegateProvider
Public method As MethodInfo
Public Function GetLinqResource ( uri As String ) As IEnumerable
Dim value As Object = method . Invoke ( Nothing , { uri } )
Return DirectCast ( value , IEnumerable )
End Function
End Class
' ' ' < summary >
' ' ' Return a registry item in the table using its specific name property .
' ' ' ( 返 回 注 册 表 中 的 一 个 指 定 名 称 的 项 目 )
@ -77,12 +96,10 @@ Namespace Framework.Provider
For Each x As TypeEntry In LQuery . MatrixToList ' Update exists registry item or insrt new item into the table
Dim exists As TypeEntry = Find ( x . name ) ' 在 注 册 表 中 查 询 是 否 有 已 注 册 的 类 型
If exists Is Nothing Then
Call Me . typeDefs . Add ( x ) ' Insert new record . ( 添 加 数 据 )
Else ' Update exists data . ( 更 新 数 据 )
exists . Assembly = x . Assembly
exists . TypeId = x . TypeId
If Not exists Is Nothing Then
Call _typeHash . Remove ( x . name )
End If
Call _typeHash . Add ( x . name , x ) ' Insert new record . ( 添 加 数 据 )
Next
Return True
End Function
@ -100,7 +117,8 @@ Namespace Framework.Provider
. Func = x . x . Name ,
. Assembly = path ,
. name = x . attr . Type ,
. TypeId = x . attr . RefType . FullName
. TypeId = FileIO . FileSystem . GetFileInfo ( x . attr . RefType . Assembly . Location ) . Name & " ! " & x . attr . RefType . FullName ,
. DeclaringType = x . x . DeclaringType . FullName
} )
Return result
End Function