• Articles
  • API Documentation
Show / Hide Table of Contents
  • BitAddict.Aras
    • ArasException
    • ArasExtensions
    • ArasMethod
    • ArasOps
    • ArasPermissionGrant
    • CheckIdentityMembershipMethod
    • ItemIdComparer
    • ItemLock
    • Logger
    • MockInnovator
    • NaturalSortComparer
    • XmlPropertyAttribute
  • BitAddict.Aras.ArasSync
    • CommandCategoryAttribute
    • Program
    • UserMessageException
  • BitAddict.Aras.ArasSync.Commands
    • AboutCommand
    • DeployCommand
    • DeployDllCommand
    • ExportCommand
    • ExtractAllCommand
    • ExtractAmlCommand
    • ForAllCommand
    • ImportAmlCommand
    • ImportFilesCommand
    • ImportXmlCommand
    • ListDbCommand
    • LoginCommand
    • LoginStatusCommand
    • LogoutCommand
    • MergeAllCommand
    • MergeAmlCommand
    • ReplaceServerItemsCommand
    • RunAmlCommand
    • UploadDocCommand
  • BitAddict.Aras.ArasSync.Data
    • AmlFragment
    • AmlNode
    • ArasFeatureManifest
    • ClientFile
    • XmlFragment
    • XmlNode
  • BitAddict.Aras.ArasSync.Ops
    • XmlNodeExentensions
  • BitAddict.Aras.Data
    • ArasConfManifest
    • ArasDb
    • DeployDllInfo
  • BitAddict.Aras.ExternalUrlWidget
    • GetExternalUrlMethod
  • BitAddict.Aras.ExternalUrlWidget.UnitTests
    • TestGetExternalUrlMethod
  • BitAddict.Aras.Security
    • LoginInfo
  • BitAddict.Aras.Test
    • ArasNUnitTestBase
    • ArasUnitTestBase
  • BitAddict.Aras.UnitTests
    • TestArasExtensions
    • TestCheckIdentityMembership
    • TestLogger
    • TestLoginInfo
    • TestXmlPropertyAttribute

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
Namespace: BitAddict.Aras
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
Type Condition
ArasException

Logger

Global log object. Vaid during method invocation.

Declaration
public static Logger Logger { get; }
Property Value
Type Description
Logger

Methods

Apply(Item, Boolean)

Run and log query.

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)

Run and log AML query

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
Type Condition
ArasException

ApplyItem(Innovator, Item, Boolean)

Run and log Item query

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
Type Condition
ArasException

ApplyMethod(Innovator, String, String)

Run and log Aras method

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
Type Condition
ArasException

ApplySQL(Innovator, String)

Run and log SQL query

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
Type Condition
ArasException

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
Type Condition
ArasException

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
Type Condition
ArasException

FormatXml(XmlNode, Int32)

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)

Write message to log

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 Description
TResult
Type Parameters
Name Description
TResult
Back to top Generated by DocFX