index > Windows Workflow Foundation > Using 'typeof' in the Rule Editor

Using 'typeof' in the Rule Editor

Hi,

I just realized that I can't use the 'typeof' expression when writing a WF rule condition.

Let's say I have a method called 'foo', that looks like this: bool foo(Type someType) {}

When writing the rule condition, I tried to write: foo(typeof(MyObj)) == true. No luck.

I also tried ommiting the 'typeof' expression and just write it like this: foo(MyObj) == true.

When writing it in the second form, the Rule Condition dialog will display a message telling you that it does not support CodeTypeReference expressions.

I know I can use the 'Type.GetType' method but I'd hate to write the fully qualified type name everytime I need to use this functionality.

So, has anyone found a better solution to this problem?

Have I overlooked something (C'mon, say yes :))

Thanks in advance,

 

PS - I'm guessing this is also why I can't really use generics in the rule editor.. Just out of curiousity, will there be support for generics in the future?




when it comes to security - if it works both ways, it doesn't work :)
Rei Shapira

Hello Rei,

Yes, we dont support the CodeTypeOfExpression. I just quickly tried doing the following: foo(obj.GetType()) - that works.

The Rule Engine uses CodeDom heavily but does not support all CodeDom expressions in the V1 release - some we dont are - CodeTypeOfExpression as you figured out, CodeObjectCreateExpression etc. We are adding support to more CodeDom expressions in the future releases.

We also do not support generics, however, not for the same reason. The reason for not supporting generics is that is requires type inferencing with explicit / implicit generic methods, and we just did not have time to get this right for our V1 release. We might investigate supporting this in the future releases.

Hope this helps,

Kavita




Program Manager, Rules, Connected Framework: http://blogs.msdn.com/rulesteam
Kavita Kamani
reply 2

You can use google to search for other answers

 

More Articles

• Usings Custom Activities
• Installing Visual Studio 2005 Extensions for Windows Workflow Fou...
• Lab 10 on beta 2.2
• Monitor example throws: "Could not load file or assembly Def...
• event in a workflow
• Visual Studio Tools for windows workflow foundation
• Asp.Net, state machine workflow, delay activity for notification
• WWF for VS.NET 2005 Full Flavor!
• CreateTask Activity
• Validation of Declarative Rule Condition fails in Designer Hostin...
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• using External Service with the Custom A
• Getting Previous Activity
• Error when using SqlWorkflowPersistenceS
• How to reference to System.Workflow.Runt
• How to use Role-base in Workflow
• Compilation failed for Travel Demo
• Workflow is not firing after a response.
• ASP.Net state machine not performing sta
• How to debug with RunWorkflow method?
• Some sample about AcivityBind and Workfl
• IObjectReference interface for which all
• Error message in state machine workflow
• Updating of Properties of already runnin
• Forecast workflow behavior
• Rules Engine: Identifying fired rule at

Hot Articles

• Problem using the SqlTrackingService
• What are the alternatives to using GetAc
• Can I show the graphically workflow on t
• Deployment, Load balancing, Instancing
• Does Office Release Delay Equate to WF R
• SqlPersistenceService.sql
• going to persistence, inside workflow ru
• When an instance state WF become idle?
• WebService - Correlation - Persistance
• Windows Workflow Foundation from a busin
• Activity Type Differences from Beta1 to
• Debugging Help
• Workflow is not firing after a response.
• starting questions...
• .NET 3.0 registers wrong path

Recommend Articles

• WorkFlow Deployment, Version Control and
• State Machine Workflow with Parallel Wor
• Possible to make working WWF runtime on
• Serializable EventArgs
• Question on Queue Management
• How to load conditions from a .rules fil
• WF version packaged with WinFX Beta 2
• Beta 2 and Windows Server 2003 R2
• Help Desk Support Sample APp does not co
• Error when trying to see the designer of
• Passing data between two activities in s
• Task List presentation of "my assig
• Simple Question on Activity Properties
• WorkflowInstanceEvent details not create
• I need a way to determine whether a Wind