public CrmConnectionInfo GetConnectionInfo(CrmDbConnection connection) { var connInfo = _Cache.GetOrAdd(connection.ConnectionString, f => { WhoAmIRequest whoRequest = new WhoAmIRequest(); WhoAmIResponse whoResponse = (WhoAmIResponse)connection.OrganizationService.Execute(whoRequest); var info = new CrmConnectionInfo(); if (whoResponse != null) { info.OrganisationId = whoResponse.OrganizationId; info.UserId = whoResponse.UserId; info.BusinessUnitId = whoResponse.BusinessUnitId; } var orgEntity = connection.OrganizationService.Retrieve("organization", info.OrganisationId, new ColumnSet("name")); if (orgEntity != null) { info.OrganisationName = (string)orgEntity["name"]; } var versionReq = new RetrieveVersionRequest(); var versionResponse = (RetrieveVersionResponse)connection.OrganizationService.Execute(versionReq); if (versionResponse != null) { info.ServerVersion = versionResponse.Version; } return(info); }); return(connInfo); }
public CrmDataAdapter(string selectCommandText, CrmDbConnection connection) : base() { // var dbprovider = DbProviderFactories.GetFactory(CrmAdoConstants.Invariant); this.SelectCommand = new CrmDbCommand(connection, selectCommandText); this.SelectCommand.CommandText = selectCommandText; this.SelectCommand.Connection = connection; }
public CrmDbCommand(CrmDbConnection connection, IOperationExecutor crmCommandExecutor, ICrmOperationProvider organisationCommandProvider) { if (crmCommandExecutor == null) { throw new ArgumentNullException("crmCommandExecutor"); } if (organisationCommandProvider == null) { throw new ArgumentNullException("organisationCommandProvider"); } _DbConnection = connection; _CrmCommandExecutor = crmCommandExecutor; _OrganisationCommandProvider = organisationCommandProvider; _CommandType = CommandType.Text; _ParameterCollection = new CrmParameterCollection(); }
public CrmDbCommand(CrmDbConnection connection, IOperationExecutor crmCommandExecutor) : this(connection, crmCommandExecutor, new SqlGenerationCrmOperationProvider()) { }
public CrmDbCommand(CrmDbConnection connection, string commandText) : this(connection, CrmOperationExecutor.Instance) { _CommandText = commandText; }
public CrmDbCommand(CrmDbConnection connection) : this(connection, string.Empty) { }
protected ResultSet(CrmDbConnection connection, OrganizationRequest request, List <ColumnMetadata> columnMetadata) { _Connection = connection; _OrgRequest = request; ColumnMetadata = columnMetadata; }
public EntityMetadataResultSet(CrmDbConnection connection, OrganizationRequest request, List <ColumnMetadata> columnMetadata) : base(connection, request, columnMetadata) { }
public CrmDbTransaction(CrmDbConnection connection) { _Connection = connection; _IsolationLevel = IsolationLevel.ReadCommitted; }