/// <summary> /// Implementation of CreateOp.Create /// </summary> /// <param name="oclass">Object class</param> /// <param name="attributes">Object attributes</param> /// <param name="options">Operation options</param> /// <returns>Uid of the created object</returns> public Uid Create(ObjectClass oclass, ICollection <ConnectorAttribute> attributes, OperationOptions options) { const string operation = "Create"; ExchangeUtility.NullCheck(oclass, "oclass", this._configuration); ExchangeUtility.NullCheck(attributes, "attributes", this._configuration); LOG.Info("Exchange.Create method for {0}; attributes:\n{1}", oclass.GetObjectClassValue(), CommonUtils.DumpConnectorAttributes(attributes)); String database = (String)ExchangeUtility.GetAttValue("Database", attributes); LOG.Info("Database attribute before plugins call: " + database); plugins.OnBeforeCreate(oclass, attributes, options, _configuration); database = (String)ExchangeUtility.GetAttValue("Database", attributes); LOG.Info("Database attribute after plugins call: " + database); CreateOpContext context = new CreateOpContext() { Attributes = attributes, Connector = this, ConnectorConfiguration = this._configuration, ObjectClass = oclass, OperationName = operation, Options = options }; try { _scripting.ExecutePowerShell(context, Scripting.Position.BeforeMain); if (!_scripting.ExecutePowerShell(context, Scripting.Position.InsteadOfMain)) { CreateMain(context); } _scripting.ExecutePowerShell(context, Scripting.Position.AfterMain); return(context.Uid); } catch (Exception e) { LOG.Error(e, "Exception while executing Create operation: {0}"); throw; } }
/// <summary> /// Implementation of CreateOp.Create /// </summary> /// <param name="oclass">Object class</param> /// <param name="attributes">Object attributes</param> /// <param name="options">Operation options</param> /// <returns>Uid of the created object</returns> public Uid Create(ObjectClass oclass, ICollection <ConnectorAttribute> attributes, OperationOptions options) { const string operation = "Create"; ExchangeUtility.NullCheck(oclass, "oclass", this._configuration); ExchangeUtility.NullCheck(attributes, "attributes", this._configuration); LOGGER_API.TraceEvent(TraceEventType.Information, CAT_DEFAULT, "Exchange.Create method for {0}; attributes:\n{1}", oclass.GetObjectClassValue(), CommonUtils.DumpConnectorAttributes(attributes)); CreateOpContext context = new CreateOpContext() { Attributes = attributes, Connector = this, ConnectorConfiguration = this._configuration, ObjectClass = oclass, OperationName = operation, Options = options }; try { _scripting.ExecutePowerShell(context, Scripting.Position.BeforeMain); if (!_scripting.ExecutePowerShell(context, Scripting.Position.InsteadOfMain)) { CreateMain(context); } _scripting.ExecutePowerShell(context, Scripting.Position.AfterMain); return(context.Uid); } catch (Exception e) { LOGGER.TraceEvent(TraceEventType.Error, CAT_DEFAULT, "Exception while executing Create operation: {0}", e); throw; } }