Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NReco.Application: added LazyDelegateFactory + updated NI.Ioc depende…
…ncy to 2.0.3
- Loading branch information
Showing
19 changed files
with
112 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
using NReco; | ||
using NI.Ioc; | ||
|
||
namespace NReco.Application.Ioc { | ||
|
||
/// <summary> | ||
/// Creates lazy delegate adapter that uses IComponentFactory for resolving real delegate instance. | ||
/// </summary> | ||
public class LazyDelegateFactory : IFactoryComponent, IComponentFactoryAware { | ||
|
||
public IComponentFactory ComponentFactory { private get; set; } | ||
|
||
private Type DelegateType { get; set; } | ||
|
||
private string DelegateComponentName { get; set; } | ||
|
||
public LazyDelegateFactory(string delegateComponentName, Type delegateType) { | ||
DelegateType = delegateType; | ||
DelegateComponentName = delegateComponentName; | ||
} | ||
|
||
protected Delegate GetRealDelegate() { | ||
return (Delegate)ComponentFactory.GetComponent(DelegateComponentName, DelegateType); | ||
} | ||
|
||
public object GetObject() { | ||
var lazyDelegAdapter = new LazyDelegateAdapter(GetRealDelegate); | ||
return lazyDelegAdapter.GetDelegate(DelegateType); | ||
} | ||
|
||
public Type GetObjectType() { | ||
return DelegateType; | ||
} | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NI.Data" version="2.0.2" targetFramework="net40" /> | ||
<package id="NI.Ioc" version="2.0.2" targetFramework="net40" /> | ||
<package id="NI.Ioc" version="2.0.3.0" targetFramework="net40" /> | ||
<package id="NI.Vfs" version="2.0.0" targetFramework="net40" /> | ||
<package id="NUnit" version="2.6.3" targetFramework="net40" /> | ||
</packages> |