Accessing Metastorm objects from custom libraries
Hi.
Instead of working in Metastorm designer we would prefer to use Visual Studio with Resharper. No matter how good Metastorm Designer is it will never be as good as he above pair.
We have no problems calling our custom libraries. I even succeeded modifying process variabels. I do it like that:
var ourCustomObject = new OurExternalLibrary.HaveAccessToVariables(Current.MapMBO);
ourCustomObjectb.SomeVariable = "some value";
in VS project we have
public class HaveAccessToVariables
{
private readonly IFieldAccess fieldAccess;
public HaveAccessToVariables(IFieldAccess fieldAccess)
{
this.fieldAccess = fieldAccess;
}
public Text SomeVariable
{
get { return (Text) fieldAccess.GetField("SomeVariable "); }
set { fieldAccess.SetField("SomeVariable ", value); }
}
}
and it works perfectly. But I would also like to be able to pass Mstm object to my custom lib. But I don't know how to do that or if it is even possible at all.
I just tried to add Mstm as constructor parameter
using Metastorm.Runtime.Core;
public HaveAccessToVariables(IFieldAccess fieldAccess, Mstm mstm)
{
this.fieldAccess = fieldAccess;
this.mstm = mstm;
}
It compiles and publishes fine but during runtime it throws that it can't find Metastorm.Runtime.Core.Stub dll (which I had to reference on my dev machine to have access to Mstm class)
public class DostepDoZmiennych
{
private readonly IFieldAccess fieldAccess;
public Text bsPolisaNr
{
get { return (Text) fieldAccess.GetField("bsPolisaNr"); }
set { fieldAccess.SetField("bsPolisaNr", value); }
}
Comments
-
Hi Piotr,
The way to do this is to have two class libraries. One is a stub, that you use in your designer\customlib, this is a .NET 3.5 Assembly.
The other copy is a .NET 4.0 Assembly which is copied to Deployment\CustomLib and Engine\Dotnetbin
Engine and deployment service must be stopped when rebuilding. Designer may need to be closed.If you use the .NET 4.0 assembly in the designer directory – you won’t see it in the list of available namespace.
Basically the .NET 3.5 assembly should be a shell that just reflects the same methods.Eg Assembly1 : DesignerNET35Stub references Metastorm.Runtime.Core.Stub
using Metastorm.Runtime.Core;
using System;
using System.Collections.Generic;
using System.Text;namespace SharedNameSpace
{
public class MySharedClass
{
private string myTestProperty;public string MyTestProperty { get{ return myTestProperty; } set{ throw new NotImplementedException(); } } }
}
Eg Assembly2 : EngineNET40Library is a .NET 4.0 Assembly referencing Metastorm.Runtime.Core
using Metastorm.Runtime.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace SharedNameSpace
{
public class MySharedClass
{
private string myTestProperty;public string MyTestProperty { get { return myTestProperty; } set { myTestProperty = value; } }
}
}Depending on what you are doing you may want to reference Metastorm.Runtime.Contracts.
Hope this helps,
Rich0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 150 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories