internal static IEntityDescriptor Create(MethodDescriptor methodDescriptor, IDispatcher dispatcher)
 {
     IEntityDescriptor result = null;
     if (dispatcher is OrleansDispatcher)
     {
         var orleanDispatcher = (OrleansDispatcher)dispatcher;
         //var guid = orleanDispatcher.GetGuidForMethod(methodDescriptor);
         // I think we should consult the dispatcher about an existing ID for the descriptor
         result = new OrleansEntityDescriptor(methodDescriptor); //System.Guid.NewGuid());
     }
     else
     {
         result = new MethodEntityDescriptor(methodDescriptor);
     }
     return result;
 }
        public MethodEntity ParseLibraryMethod()
        {
            if (this.RetVar != null)
            {
                this.StatementProcessor.RegisterNewExpressionAssignment(RetVar,
                                            new TypeDescriptor(RetVar.Type,false));
            }

            var descriptor = new MethodEntityDescriptor(this.MethodDescriptor); //EntityFactory.Create(this.MethodDescriptor, this.Dispatcher);
            var methodEntity = new MethodEntity(this.MethodDescriptor,
                                                    this.MethodInterfaceData,
                                                    this.PropGraph, descriptor,
                                                    this.InstantiatedTypes,
                                                    false);
            return methodEntity;
        }