SubSonic-3.0 icon indicating copy to clipboard operation
SubSonic-3.0 copied to clipboard

InlineQuery and ExecuteTypedList()

Open vovikdrg opened this issue 13 years ago • 0 comments

i have query new InlineQuery(Provider, usersSql).ExecuteTypedList<User>(); but in my user model i have SubSonicColumnNameOverrideAttribute and it doesnt work properly overrided columns are not set.

But why not to work with Columns override instead of passing column names like in Database.Load<T>(

var overridingAttributes = (from p in iType.GetProperties() let attr = p.GetCustomAttributes(typeof(SubSonicColumnNameOverrideAttribute), true) select new { Property = p, Attribute = attr.First() as SubSonicColumnNameOverrideAttribute });

and replace if (currentProp == null && ColumnNames != null && ColumnNames.Count > i) { currentProp = cachedProps.First(x => x.Name == ColumnNames[i]); }

to

if (currentProp == null) { dynamic customObject = overridingAttributes.FirstOrDefault(arg => arg.Attribute.ColumnName == pName); if (customObject != null) { currentProp = customObject.Property; } }

vovikdrg avatar Jan 31 '12 18:01 vovikdrg