Class ArasExtensions
Extensions to ease development of Aras Innovator methods.
These methods can be used from classes that do not inherit ArasMethod.
Inheritance
System.Object
ArasExtensions
Assembly: BitAddict.Aras.dll
Syntax
public static class ArasExtensions
Fields
LogRootFolder
Master Log root folder. Per database and method logs are created in/beneath this.
Declaration
public static string LogRootFolder
Field Value
Type |
Description |
System.String |
|
Properties
Innovator
Global Innovator ojbect. Valid during method invocation.
Declaration
public static Innovator Innovator
{
[NotNull]
get;
}
Property Value
Type |
Description |
Aras.IOM.Innovator |
|
Exceptions
Logger
Global log object. Vaid during method invocation.
Declaration
public static Logger Logger { get; }
Property Value
Methods
Apply(Item, Boolean)
Declaration
public static Item Apply(this Item item, bool logResult = true)
Parameters
Type |
Name |
Description |
Aras.IOM.Item |
item |
|
System.Boolean |
logResult |
|
Returns
Type |
Description |
Aras.IOM.Item |
|
ApplyAML(Innovator, String)
Declaration
[NotNull]
public static Item ApplyAML(this Innovator innovator, [NotNull] string amlQuery)
Parameters
Type |
Name |
Description |
Aras.IOM.Innovator |
innovator |
|
System.String |
amlQuery |
|
Returns
Type |
Description |
Aras.IOM.Item |
|
Exceptions
ApplyItem(Innovator, Item, Boolean)
Declaration
[NotNull]
public static Item ApplyItem(this Innovator _, [NotNull] Item item, bool logResult = true)
Parameters
Type |
Name |
Description |
Aras.IOM.Innovator |
_ |
|
Aras.IOM.Item |
item |
|
System.Boolean |
logResult |
|
Returns
Type |
Description |
Aras.IOM.Item |
|
Exceptions
ApplyMethod(Innovator, String, String)
Declaration
[NotNull]
public static Item ApplyMethod(this Innovator innovator, [NotNull] string method, [NotNull] string body)
Parameters
Type |
Name |
Description |
Aras.IOM.Innovator |
innovator |
|
System.String |
method |
|
System.String |
body |
|
Returns
Type |
Description |
Aras.IOM.Item |
|
Exceptions
ApplySQL(Innovator, String)
Declaration
[NotNull]
public static Item ApplySQL(this Innovator innovator, [NotNull] string sqlQuery)
Parameters
Type |
Name |
Description |
Aras.IOM.Innovator |
innovator |
|
System.String |
sqlQuery |
|
Returns
Type |
Description |
Aras.IOM.Item |
|
Exceptions
CallMethod(String, Func<Item, Item>, Item)
Apply a generic callable on an item, while logging invocation and errors.
Declaration
[NotNull]
public static Item CallMethod([NotNull] string methodName, [NotNull] Func<Item, Item> method, [NotNull] Item item)
Parameters
Type |
Name |
Description |
System.String |
methodName |
|
System.Func<Aras.IOM.Item, Aras.IOM.Item> |
method |
|
Aras.IOM.Item |
item |
|
Returns
Type |
Description |
Aras.IOM.Item |
|
CallMethod<TMethod>(Item)
Create and apply an ArasMethod via reflection on single line.
Allows exceptions in constructor to be logged
Declaration
public static Item CallMethod<TMethod>([NotNull] Item item)
where TMethod : ArasMethod
Parameters
Type |
Name |
Description |
Aras.IOM.Item |
item |
Item to apply, must be server method's 'this' object.
|
Returns
Type |
Description |
Aras.IOM.Item |
|
Type Parameters
Name |
Description |
TMethod |
The ArasMethod type to run
|
Enumerate(Item)
Convert multi-result Item to IEnumerable<Item>
Declaration
public static IEnumerable<Item> Enumerate(this Item items)
Parameters
Type |
Name |
Description |
Aras.IOM.Item |
items |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Aras.IOM.Item> |
|
Exceptions
FetchRelationships(Innovator, Item, String, String)
Run and log fetchRelationships query
Declaration
[NotNull]
public static Item FetchRelationships(this Innovator _, [NotNull] Item item, string relationShipTypeName, string selectList = "related_id(*)")
Parameters
Type |
Name |
Description |
Aras.IOM.Innovator |
_ |
|
Aras.IOM.Item |
item |
|
System.String |
relationShipTypeName |
|
System.String |
selectList |
|
Returns
Type |
Description |
Aras.IOM.Item |
|
Exceptions
Generate indented XML string
Declaration
public static string FormatXml(this XmlNode node, int indent = 4)
Parameters
Type |
Name |
Description |
System.Xml.XmlNode |
node |
node to print
|
System.Int32 |
indent |
default indent
|
Returns
Type |
Description |
System.String |
|
GetItemById(Innovator, String, String)
Run and log Innovator.getItemById() query
Declaration
public static Item GetItemById(this Innovator innovator, [NotNull] string itemType, [NotNull] string id)
Parameters
Type |
Name |
Description |
Aras.IOM.Innovator |
innovator |
innovator ojb
|
System.String |
itemType |
item type
|
System.String |
id |
item id
|
Returns
Type |
Description |
Aras.IOM.Item |
|
GetItemByKeyedName(Innovator, String, String)
Run and log Innovator.getItemByKeyedName() query
Declaration
public static Item GetItemByKeyedName(this Innovator innovator, [NotNull] string itemType, [NotNull] string keyedName)
Parameters
Type |
Name |
Description |
Aras.IOM.Innovator |
innovator |
|
System.String |
itemType |
|
System.String |
keyedName |
|
Returns
Type |
Description |
Aras.IOM.Item |
|
GetNewInnovator(String, String, String, String)
Create a new connection and return the innovator.
Declaration
public static Innovator GetNewInnovator([NotNull] string url, [NotNull] string databaseName, [NotNull] string username, [NotNull] string password)
Parameters
Type |
Name |
Description |
System.String |
url |
|
System.String |
databaseName |
|
System.String |
username |
|
System.String |
password |
|
Returns
Type |
Description |
Aras.IOM.Innovator |
|
Log(String, String)
Declaration
public static void Log(string tag, string message)
Parameters
Type |
Name |
Description |
System.String |
tag |
|
System.String |
message |
|
LogException(String, Exception)
Log exception to error log and method log
Declaration
public static string LogException(string msg, Exception exception)
Parameters
Type |
Name |
Description |
System.String |
msg |
|
System.Exception |
exception |
|
Returns
Type |
Description |
System.String |
|
LogIfException(Action)
Catch and log exception if it occurs.
Declaration
public static bool LogIfException(Action action)
Parameters
Type |
Name |
Description |
System.Action |
action |
|
Returns
Type |
Description |
System.Boolean |
true if ok, false on logged exception
|
LogTime(Action, String)
Measure and log time for a given action
Declaration
public static void LogTime(Action action, string tag)
Parameters
Type |
Name |
Description |
System.Action |
action |
|
System.String |
tag |
|
LogTime<TResult>(Func<TResult>, String)
Measure and log the time for a function that returns a value
Declaration
public static TResult LogTime<TResult>(Func<TResult> func, string tag)
Parameters
Type |
Name |
Description |
System.Func<TResult> |
func |
|
System.String |
tag |
|
Returns
Type Parameters