I've writing a small application tag replicates an AF database to the Module database. Yes I know 3.5 is coming out; but I decided to do this because I would like something now and secondly for my own edification.
The issue I'm having is that I get an exception creating a module property; I pretty sure that I'm doing something stupid but I can't figure it out. The error message is:
Object reference not set to an instance of an object.
Below is the snippet of code that is generating the exception:
PIModule mdbModule, OSIsoft.AF.Asset.AFElement _afElement)
If I replace the afElement.Template.Name with a simple string (not a variable) then it works if I try an pass any variables into the PIProperties.Add method I get an error.
On a related point how do you set the property type?
Last question: are there any examples of creating modules with properties and aliases. I've gone through examples on the vcampus and those installed with PI but I haven't seen anything.