You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have an object that has a property of type Enum, all get querys fail with a message like Property '[ColumnName]' with type '[Enumtype]' does not match column with the same name..
This is expected, since Enums aren't mentioned anywhere in the docs.
I tried to get around this by making a specific class specific for my query where i change the type of my Enum to a string, but this didn't work either.
I Created a test that shows my problem. It should run in LinqPad or a Console.App
voidMain(){varDB=newunQuery.unQueryDB("DB_Connection");using(vartransScope=newTransactionScope()){// Create temp table and populate itDB.Execute(@" IF NOT (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'EnumTest')) BEGIN CREATE TABLE EnumTest( ValueField1 NVARCHAR(30), ValueField2 NVARCHAR(30) ) INSERT INTO EnumTest (ValueField1, ValueField2) VALUES ('EnumVal1', 'Bananas'); INSERT INTO EnumTest (ValueField1, ValueField2) VALUES ('EnumVal2', 'Phones'); END ");// WorkstryType<ObjectStringDTO>(DB);// Fails - Which is expectedtryType<ObjectEnumDTO>(DB);// Fails - But i would expect it to worktryType<ObjectNewStringDTO>(DB);}}voidtryType<T>(unQueryDBDB){try{Console.Write(DB.GetRows<T>("SELECT ValueField1, ValueField2 FROM EnumTest"));}catch(Exceptionex){ex.Message.Dump();}}enumMyEnum{EnumVal1,EnumVal2}classObjectStringDTO{publicstringValueField1{get;set;}publicstringValueField2{get;set;}}classObjectEnumDTO{publicMyEnumValueField1{get;set;}publicstringValueField2{get;set;}}classObjectNewStringDTO:ObjectEnumDTO{publicnewstringValueField1{get;set;}}
The text was updated successfully, but these errors were encountered:
@boedlen I assume the ideal case would be for unQuery to support the String<=>Enum mapping directly? In other words, your ObjectNewStringDTO is a workaround (also not supported), not how you'd ideally want to work with this - correct?
If you have an object that has a property of type
Enum
, all get querys fail with a message like Property '[ColumnName]' with type '[Enumtype]' does not match column with the same name..This is expected, since Enums aren't mentioned anywhere in the docs.
I tried to get around this by making a specific class specific for my query where i change the type of my Enum to a string, but this didn't work either.
I Created a test that shows my problem. It should run in LinqPad or a Console.App
The text was updated successfully, but these errors were encountered: