Last active
June 12, 2017 03:23
-
-
Save countoren/013bdbef42891ec21dd61692aa652f7e to your computer and use it in GitHub Desktop.
Castle DictionaryAdapeter Test
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Castle.Components.DictionaryAdapter; | |
using SAPbobsCOM; | |
namespace testCastleDictAdapter | |
{ | |
public interface IPerson | |
{ | |
string Name { get; set; } | |
int Age { get; set; } | |
void Close(); | |
} | |
public class Program | |
{ | |
public static T CreateProxyObject<T>(Dictionary<string,Object> d) | |
{ | |
return new DictionaryAdapterFactory().GetAdapter<T>(d); | |
} | |
static void Main(string[] args) | |
{ | |
var d = new Dictionary<string, object> | |
{ | |
{"Name", "abc"}, | |
}; | |
/**fails in this line with: | |
Method 'Close' in type 'CastleDictionaryAdapterType' from assembly 'CastleDictionaryAdapterAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. | |
**/ | |
var p = CreateProxyObject<IPerson>(d); | |
var name = p.Name; | |
if (false) | |
p.Close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment