Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pudding-fox/rundll
Create a transparent proxy to a different .NET runtime.
https://github.com/pudding-fox/rundll
dotnet dotnet-core dotnet-framework proxy
Last synced: about 1 month ago
JSON representation
Create a transparent proxy to a different .NET runtime.
- Host: GitHub
- URL: https://github.com/pudding-fox/rundll
- Owner: pudding-fox
- Created: 2024-07-22T16:36:22.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-25T19:22:24.000Z (4 months ago)
- Last Synced: 2024-10-13T01:41:53.008Z (about 1 month ago)
- Topics: dotnet, dotnet-core, dotnet-framework, proxy
- Language: C#
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A simple example (see the tests):
```c#
//Some code in a .net core app:
//Since 2.0.0 the mapping is optional. We will scan for an implementation of your interface.
var mapping = new Mapping()
{
//Map the interface to the location of the implementation.
//The implementation is a .net framework assembly.
{ new Mapping.Key(typeof(ITestClass)), new Mapping.Value("RunDll.Tests.Data.dll", "RunDll.TestClass") }
};
using (var client = new Client(Runtime.NetFramework, mapping))
{
var expected = "Hello Test!";
var actual = client.Target.Hello("Test");
Assert.AreEqual(expected, actual);
}
```
Declare the interface as a copy or use multi targetting.
```c#
public interface ITestClass
{
string Hello(string name);
}
```
The implementation.
```c#
public class TestClass : ITestClass
{
public string Hello(string name)
{
return string.Concat("Hello ", name, "!");
}
}
```
If the implementation contains a method object GetTarget(object) it will be called. Config is passed from the Mapping.
```c#
public class TestClass2
{
public ITestClass1 GetTarget(object config)
{
return new TestClass1();
}
}
```
See the tests.