B.GetProperties()
211; [0] Balance (type: Account), [1] Balance (type:
CProxyAccount_IPersistable…)
The code
error at “_setProperties.Add(name, properties[i])” : Exception ~
key already exist.
Added:
In order to support Proxy object mapping, I commented out line 312 – 315
in ResultMap.cs:
/*if ( target.GetType() != _class )
{
throw new ArgumentException( "Could not set value of type '"+
target.GetType() +"' in property '"+property.PropertyName+"' of
type '"+_class+"'" );
}*/
In order to
overcome the issue I changed ReflectionInfo.AddProperties to:
PropertyInfo[] properties = type.GetProperties(BINDING_FLAGS_SET);
for (int i = 0; i < properties.Length; i++)
{
string name = properties[i].Name;
if (_setProperties.ContainsKey(name))
{
// determine if this is the better key
if (properties[i].DeclaringType.Equals(type))
{
_setProperties.Remove(name);
_setTypes.Remove(name);
}
else
continue;
}
_setProperties.Add(name, properties[i]);
_setTypes.Add(name, properties[i].PropertyType);
}…
This requires local build of DataMapper and keeps track of changes.
Request:
Also, I would like something similar for QueryForList…
SqlMapper.QueryForList(“SomeStatement”, parameter,
dummyValueObject, list) where the IBatisNet use dummyObject type (proxy type)
as object type to add to list…;
I.E:
IList<Account> lst = new List<Account>();
SqlMapper.QueryForList(“SomeStatement”, parameter,
ProxyManager.CreateInstance(typeof(Account)), lst);
return lst;
Thanks,
Tom Nguyen
Powered By IBatisNet DataMapper v1.3.xxx on .NET 2.0