0

I'm not finding an ORM that does this for .net 2.0 (i know it's old but some clients still use it)... anyway, I want to generate a class or properties from a sql query at runtime and use it. So, I use subsonic now and I generate the classes and then add them to my project..etc and this is great for objects I'm using all the time but sometimes for quick queries I want to be able to do something like this:

QueryClass result = ...(SELECT * FROM)
...SHOW(result.Column1, result.Column2)

So, above isn't real code but I want it to work like this. Anyone point me in the right direction?

1
  • 1
    you can't do that with .net 2.0 easily. .net 3.5 you can a bit easier with anonymous types. Commented Jan 19, 2012 at 18:54

1 Answer 1

1

Can you use a Dictionary?

Dictionary<string, object> result = ...(SELECT * FROM)
...SHOW(result["Column1"], result["Column2"])
Sign up to request clarification or add additional context in comments.

2 Comments

yes, I have done that in the past, I thought I'd try this out though. I don't know if it can be done.
As @Daniel A. White said, neither dynamic nor anonymous types exist in .NET 2.0. So, I don't think it's possible without creating a dedicated class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.