Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Equivalent to eval()
Message
 
 
To
30/03/2010 07:23:14
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01457734
Message ID:
01458084
Views:
44
>>>>For lurkers, I thought I'd post my results :
>>>>
>>>>this technique works for public properties and works well.
>>>>
>>>>Here's the VB version of what I did
>>>>
>>>>We are asssuming there are a dozen public properties of type BaseBO
>>>>Based on a string we are going to find out the number of records in that BO
>>>>(the actually string is derived from evaluating the displayvalue of an enum at run-time)
>>>>
>>>>
>>>>Dim childname as string = "GL"
>>>>Dim childbo as Basebo 
>>>>Dim pd As PropertyDescriptor = _
>>>>TypeDescriptor.GetProperties(Me).Find(childname, True)
>>>>
>>>>         If Not IsDBNull(pd) Then
>>>>                  childbo = CType(pd.GetValue(Me), BaseBO)
>>>>                  childcount = childbo.Count
>>>>          End If
>>>>
>>>>
>>>>Thanks Cetin
>>>>
>>>>(the function Michel posted is very useful when the BO is assigned to a private variable instead of a property )
>>>
>>>Birsey degil:)
>>>
>>>BTW download LinqPad 4 from www.linqpad.net if you haven't already. It simply rocks. Watch webcast for a peek of new features (you can even do interactive VB there although biased to C#:)
>>>Cetin
>>
>>Thanks for the tip. But is SQL really antiquated? ;-)
>
>No, SQL is not antiquated, at least not yet, when there are many T-SQL thinking guys like us vs the easier and more intuitive object query:) If I were a guy who didn't know SQL, with EF and Linq, I would feel at home and do data centric applications easily. Now that I am a guy who knows some SQL, it would take me some time to see the things from the easier ObjectQuery perspective but it is addictive. Also, at least for now, there would be objections claiming EF is slow and sorts of things like that. They are, maybe thought and right, but temporary objections. Time is ticking towards OQ benefit.
>
>That LinqPad (either 2 that works with .Net 2-3.5 or the new 4) can do Linq in C#/VB and besides that can do SQL, ESQL! IMHO it has value even for those folks who chose not to use .Net. If you ask how, I use it sometimes just to 'steal' some complex SQL code. Writing such complex things in Object query is easier (because Object Query sounds more natural language to a mortal like me) than writing in T-SQL. Then I click on SQL tab and get the T-SQL syntax. Further I can directly 'Analyze SQL' there and rectify more if I need to.
>
>It is interactive IDE for C#/VB/SQL/ESQL:) In LinqPad 4 it nails it in a way you start to think why MS can't build such an easy to use and fast IDE. For example (this is one of the new features demonstrated in webcast) when working with Silverlight or WPF at least in intial phases I was going nuts to find the files to add to reference. Say I need a textbox to use in WPF, I can now simply type textbox and little red underline pops on last letter, clicking give you all the libraries it is referenced and you simply pick Presentation library it adds all the needed ones. You can write and test a XAML with events, run dynamic code, connect to EF, WCF, MySQL, SQLite ... In short a little nice code test scratchpad (and of course you can save/serach etc those codes you test in folders).
>
>Assuming you purchase autocompletion license (I severe I have no relation to Joseph Albahari except that I wish I could transplant his brain, he certainly deserves the promotion especially it is for your benefit more than to his:) LinqPad rocks! If you don't then it is still a free and cool utility one must have on his desktop (small download and I have both versions side by side in my Quick Launch bar:)
>
>Well download, you have to see it - and watch the webcast IMHO:)
>

Thanks for the info. You are not exactly a piker yourself, you know ;-) If you say it's worth checking out then I believe you.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform