Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 public CrmDbCommand(CrmDbConnection connection, IOperationExecutor crmCommandExecutor)
     : this(connection, crmCommandExecutor, new SqlGenerationCrmOperationProvider())
 {
 }
Esempio n. 5
0
 public CrmDbCommand(CrmDbConnection connection, string commandText)
     : this(connection, CrmOperationExecutor.Instance)
 {
     _CommandText = commandText;
 }
Esempio n. 6
0
 public CrmDbCommand(CrmDbConnection connection)
     : this(connection, string.Empty)
 {
 }
Esempio n. 7
0
 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)
 {
 }
Esempio n. 9
0
 public CrmDbTransaction(CrmDbConnection connection)
 {
     _Connection     = connection;
     _IsolationLevel = IsolationLevel.ReadCommitted;
 }