Skip to content

Instantly share code, notes, and snippets.

@countoren
Last active June 12, 2017 03:23
Show Gist options
  • Save countoren/013bdbef42891ec21dd61692aa652f7e to your computer and use it in GitHub Desktop.
Save countoren/013bdbef42891ec21dd61692aa652f7e to your computer and use it in GitHub Desktop.
Castle DictionaryAdapeter Test
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