Reflection &Activator
HowardL
Reflection
 Reflection provides objects (of typeType) that describe assemblies,
modules and types.
 You can use reflection to dynamically create an instance of a type,
bind the type to an existing object, or get the type from an
existing object and invoke its methods or access its fields and
properties.
 If you are using attributes in your code, reflection enables you to
access them.
Console WebApi
PatentASSG
PatentABST
PatentCLAS
CPC
PatentCLAS
IPC
PatentCLMS
PatentFULL
Update Patent
DataOutside
 Console流程
 準備廠商家DB的documentIds(pn, apn, dataSource, apt, kindCode)
 透過執行Console時給的args, 決定要Create哪個Class Instance,
Constructor中會給LastSn Property目前廠商家資料庫最後一筆SN
 取用Class Instance的WebApiUrl Property的值, 決定我跟WebApi是
要甚麼資料
 取回來的資料再Invoke此Instance的方法, 做資料Insert
 最後, 批次處理全部結束後, 再Invoke另一個Instance的方法, 做刪
除舊資料(透過LastSn)
Update Patent
Data Inside
 Console流程
 準備自家DB的documentIds(pn, apn, dataSource, apt, kindCode)
 透過執行Console時給的args, 決定要Create哪個Class Instance,
Constructor中會給LastSn Property目前自家資料庫最後一筆SN
 透過執行Console時給的args, 決定哪個Class Instance(另一個專案),
並取用他的靜態方法, 模擬WebApi取資料的事
 取回來的資料再Invoke此Instance的方法, 做資料Insert
 最後, 批次處理全部結束後, 再Invoke另一個Instance的方法, 做刪
除舊資料(透過LastSn)
Reference  https://msdn.microsoft.com/zh-tw/library/ms173183.aspx

Reflection & activator

  • 1.
  • 2.
    Reflection  Reflection providesobjects (of typeType) that describe assemblies, modules and types.  You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties.  If you are using attributes in your code, reflection enables you to access them.
  • 3.
  • 4.
    Update Patent DataOutside  Console流程 準備廠商家DB的documentIds(pn, apn, dataSource, apt, kindCode)  透過執行Console時給的args, 決定要Create哪個Class Instance, Constructor中會給LastSn Property目前廠商家資料庫最後一筆SN  取用Class Instance的WebApiUrl Property的值, 決定我跟WebApi是 要甚麼資料  取回來的資料再Invoke此Instance的方法, 做資料Insert  最後, 批次處理全部結束後, 再Invoke另一個Instance的方法, 做刪 除舊資料(透過LastSn)
  • 5.
    Update Patent Data Inside Console流程  準備自家DB的documentIds(pn, apn, dataSource, apt, kindCode)  透過執行Console時給的args, 決定要Create哪個Class Instance, Constructor中會給LastSn Property目前自家資料庫最後一筆SN  透過執行Console時給的args, 決定哪個Class Instance(另一個專案), 並取用他的靜態方法, 模擬WebApi取資料的事  取回來的資料再Invoke此Instance的方法, 做資料Insert  最後, 批次處理全部結束後, 再Invoke另一個Instance的方法, 做刪 除舊資料(透過LastSn)
  • 6.

Editor's Notes

  • #3 Reflection提供程式在執行期間能取得其Assembly、Module、Type這些資訊的能力。 用Reflection能動態建立一個type的instance bind type到一個存在的物件 從一個存在的物件拿到他的type, 再invoke他的方法或是存取fields和properties