コード例 #1
0
ファイル: Insert.cs プロジェクト: shoy160/Shoy.Common
        /// <summary>
        /// 执行Command
        /// </summary>
        /// <param name="cc"></param>
        /// <returns></returns>
        public int Execute(IConnectionContext cc)
        {
            Command cmd = Command.GetThreadCommand().AddSqlText("Insert into ").AddSqlText(_mTable);
            StringBuilder names = new StringBuilder(),
                          values = new StringBuilder();
            for (int i = 0; i < _mInserFields.Count; i++)
            {
                if (i > 0)
                {
                    names.Append(",");
                    values.Append(",");
                }
                Field field = _mInserFields[i];
                names.Append(field.Name);
                if (field.IsParameter)
                {
                    values.Append("@").Append(field.ParameterName);
                    cmd.AddParameter(field.ParameterName, field.Value ?? DBNull.Value);
                }
                else
                    values.Append(field.Value);

            }
            cmd.SqlText.Append("(").Append(names).Append(")").Append(" Values(").Append(values).Append(")");
            return cc.ExecuteNonQuery(cmd);
        }
コード例 #2
0
ファイル: Delete.cs プロジェクト: shoy160/Shoy.Common
        /// <summary>
        /// 执行Command
        /// </summary>
        /// <param name="cc"></param>
        /// <returns></returns>
        public int Execute(IConnectionContext cc)
        {
            Command cmd = Command.GetThreadCommand().AddSqlText("Delete from ").AddSqlText(_mTable);

            return 0;
            return cc.ExecuteNonQuery(cmd);
        }
コード例 #3
0
 static string SqlQuery(Field[] keys, IConnectionContext context, string tempTable, Field hashCode) {
     var names = string.Join(",", keys.Select(f => "k.[" + f.FieldName() + "]"));
     var table = context.Entity.OutputTableName(context.Process.Name);
     var joins = string.Join(" AND ", keys.Select(f => "o.[" + f.FieldName() + "] = k.[" + f.FieldName() + "]"));
     var sql = string.Format("SELECT {0},o.[{1}] FROM #{2} k WITH (NOLOCK) INNER JOIN [{3}] o WITH (NOLOCK) ON ({4})", names, hashCode.FieldName(), tempTable, table, joins);
     context.Debug(sql);
     return sql;
 }
コード例 #4
0
		public SignalRUserDisconnectedEventArgs(IPrincipal principal, IConnectionContext context)
		{
			Contract.Requires(principal != null);
			Contract.Requires(context != null);

			if (principal == null) throw new ArgumentNullException("principal");
			if (context == null) throw new ArgumentNullException("context");

			Contract.Ensures(this.Principal != null);
			Contract.Ensures(this.Context != null);

			this.Principal = principal;
			this.Context = context;
		}
コード例 #5
0
        public SqlEntityMatchingKeysReader(IConnectionContext context, Field[] keys) {

            var tempTable = context.Entity.GetExcelName();

            _context = context;
            _keys = keys;
            _rowCapacity = context.GetAllEntityFields().Count();
            _hashCode = context.Entity.TflHashCode();
            _fields = CombineFields(keys, _hashCode);
            _create = SqlCreateKeysTable(context, tempTable);
            _insert = SqlInsertTemplate(context, tempTable, keys);
            _query = SqlQuery(keys, context, tempTable, _hashCode);
            _drop = SqlDrop(context, tempTable);
            _rowCreator = new SqlRowCreator(context);
        }
		public SignalREventRaisedFromClientEventArgs(string eventName, RequestBase request, IConnectionContext context)
		{
			Contract.Requires(eventName != null);
			Contract.Requires(request != null);
			Contract.Requires(context != null);

			if (eventName == null) throw new ArgumentNullException("eventName");
			if (request == null) throw new ArgumentNullException("request");
			if (context == null) throw new ArgumentNullException("context");

			Contract.Ensures(this.EventName != null);
			Contract.Ensures(this.Request != null);
			Contract.Ensures(this.Context != null);

			this.EventName = eventName;
			this.Request = request;
			this.Context = context;
		}
コード例 #7
0
		public SignalRExceptionEventArgs(IPrincipal principal, Exception ex, IConnectionContext context, string associatedEventName)
		{
			Contract.Requires(principal != null);
			Contract.Requires(ex != null);
			Contract.Requires(context != null);

			if (principal == null) throw new ArgumentNullException("principal");
			if (ex == null) throw new ArgumentNullException("ex");
			if (context == null) throw new ArgumentNullException("context");

			Contract.Ensures(this.Principal != null);
			Contract.Ensures(this.Exception != null);
			Contract.Ensures(this.Context != null);

			this.Principal = principal;
			this.Exception = ex;
			this.Context = context;
			this.AssociatedEventName = associatedEventName;
		}
コード例 #8
0
 public ConnectionDisconnectedState(IConnectionContext context, ErrorInfo error, ILogger logger)
     : this(context, error, new CountdownTimer("Disconnected state timer", logger), logger)
 {
 }
コード例 #9
0
        /// <summary>
        /// Executes a MethodInstance in the model against the specified external system instance with given parameters.
        /// </summary>
        /// <param name="methodInstance">The method instance being executed.</param>
        /// <param name="lobSystemInstance">The external system instance which the method instance is being executed against.</param>
        /// <param name="args">Parameters of the method. The size of the parameter array is equal to the number of parameter objects in the method definition in the BCS model file, and the values are passed in order. Out and return parameters will be a null reference.</param>
        /// <param name="context">ExecutionContext in which this execution is happening. This value will be a null reference if ExecutionContext is not created.</param>
        /// <remarks>
        /// This method is executed in a separate thread.
        /// </remarks>
        public override void ExecuteStatic(Microsoft.BusinessData.MetadataModel.IMethodInstance methodInstance, Microsoft.BusinessData.MetadataModel.ILobSystemInstance lobSystemInstance, object[] args, Microsoft.BusinessData.Runtime.IExecutionContext context)
        {
            // Modify the execution behaviour for the method instance types that are used in the Glyma repository model and revert to the base class implementation
            // for all other method instance types (until a better understanding is developed on how the other method instance types are used).
            switch (methodInstance.MethodInstanceType)
            {
            case MethodInstanceType.Finder:
            case MethodInstanceType.SpecificFinder:
            case MethodInstanceType.AssociationNavigator:
            case MethodInstanceType.ChangedIdEnumerator:
            case MethodInstanceType.DeletedIdEnumerator:
            case MethodInstanceType.BinarySecurityDescriptorAccessor:

                // Validate parameters to ensure all required execution details are available.
                if (methodInstance == null)
                {
                    throw new ArgumentNullException("methodInstance");
                }

                if (lobSystemInstance == null)
                {
                    throw new ArgumentNullException("lobSystemInstance");
                }

                if (args == null)
                {
                    throw new ArgumentNullException("args");
                }

                if (context == null)
                {
                    throw new ArgumentNullException("context");
                }

                IConnectionContext connectionContext = (IConnectionContext)context["ConnectionContext"];
                if (connectionContext == null)
                {
                    throw new ArgumentNullException("The BDC execution context doesn't contain a connection context.");
                }

                // Create the proxy and execute the method.
                GlymaRepositoryProxy proxy = null;
                try
                {
                    proxy = CreateProxy();
                    if (proxy == null)
                    {
                        throw new ArgumentException("The proxy returned from the BDC shim is null.");
                    }

                    GlymaSearchLogger.WriteTrace(LogCategoryId.Connector, TraceSeverity.Verbose, "Configuring proxy to execute " + methodInstance.MethodInstanceType.ToString() + " method for: " + connectionContext.Path.OriginalString);
                    SetGlobalSettings(proxy, lobSystemInstance.GetLobSystem().GetProperties());
                    SetStartAddress(proxy, connectionContext.Path.OriginalString);
                    SetRepositoryName(proxy, lobSystemInstance.Name);
                    SetMapConnectionString(proxy, lobSystemInstance.GetProperties(), lobSystemInstance.Name);

                    // Get the definition of the fields for the entity that will be returned by the proxy method.  This enables the connector to build entities
                    // based on the definitions in the model file instead of having entities with fixed pre-defined properties.
                    ITypeDescriptorCollection entityFields = GetEntityFields(methodInstance);

                    GlymaSearchLogger.WriteTrace(LogCategoryId.Connector, TraceSeverity.Verbose, "Executing " + methodInstance.MethodInstanceType.ToString() + " proxy method for: " + connectionContext.Path.OriginalString);
                    ExecuteProxyMethod(proxy, methodInstance, args, entityFields);
                    GlymaSearchLogger.WriteTrace(LogCategoryId.Connector, TraceSeverity.Verbose, "Completed execution of " + methodInstance.MethodInstanceType.ToString() + " proxy method for: " + connectionContext.Path.OriginalString);
                }
                catch (Exception currentException)
                {
                    GlymaSearchLogger.WriteTrace(LogCategoryId.Connector, TraceSeverity.Unexpected, currentException.ToString());
                    throw;
                }
                finally
                {
                    if (proxy != null)
                    {
                        DisposeProxy(proxy);
                        proxy = null;
                    }
                }
                break;

            default:
                base.ExecuteStatic(methodInstance, lobSystemInstance, args, context);
                break;
            }
        }
コード例 #10
0
 public ElasticSchemaReader(IConnectionContext input, IElasticLowLevelClient client)
 {
     _input  = input;
     _client = client;
     _index  = input.Connection.Index;
 }
コード例 #11
0
 public ConnectionConnectingState(IConnectionContext context, ICountdownTimer timer, ILogger logger)
     : base(context, logger)
 {
     _timer = timer;
 }
コード例 #12
0
 public ConnectionStateBase(IConnectionContext context)
 {
     this.Context = context;
 }
コード例 #13
0
 public ArticuloTipo(ITransformMapper transformMapper, IConnectionContext context)
 {
     _transformMapper = transformMapper;
     _context         = context;
 }
コード例 #14
0
 public TaskController(ITaskDataProvider taskDataProvider, IConnectionContext context)
 {
     _taskDataProvider = taskDataProvider;
     _context          = context;
 }
 public SignalRUserConnectedEventArgs(IPrincipal principal, IConnectionContext connectionContext)
 {
     this.Principal         = principal;
     this.ConnectionContext = connectionContext;
 }
コード例 #16
0
 public ConnectionClosedState(IConnectionContext context, ILogger logger)
     : this(context, null, logger)
 {
 }
コード例 #17
0
 public ConnectionClosedState(IConnectionContext context, ErrorInfo error, ILogger logger)
     : base(context, logger)
 {
     Error = error ?? ErrorInfo.ReasonClosed;
 }
コード例 #18
0
 public UsersController(IUsersDataProvider usersDataProvider, IConnectionContext context)
 {
     _usersDataProvider = usersDataProvider;
     _context           = context;
 }
コード例 #19
0
 public ConnectionFailedState(IConnectionContext context, TransportStateInfo transportState) :
     base(context)
 {
     this.Error = CreateError(transportState);
 }
コード例 #20
0
 public RazorWriter(IConnectionContext output, IReader templateReader)
 {
     _templateReader = templateReader;
     _output         = output;
 }
コード例 #21
0
 public SchemaReader(IConnectionContext context, IRunTimeRun runner, Process process)
 {
     _context = context;
     _runner  = runner;
     _process = process;
 }
コード例 #22
0
 public ConnectionDisconnectedState(IConnectionContext context, TransportStateInfo stateInfo) :
     this(context, CreateError(stateInfo), new CountdownTimer())
 {
 }
コード例 #23
0
 public ConnectionDisconnectedState(IConnectionContext context, ErrorInfo error) :
     this(context, error, new CountdownTimer())
 {
 }
コード例 #24
0
 public ConnectionConnectingState(IConnectionContext context, ILogger logger) :
     this(context, new CountdownTimer("Connecting state timer", logger), logger)
 {
 }
コード例 #25
0
 public ConnectionDisconnectedState(IConnectionContext context) :
     this(context, null, new CountdownTimer())
 {
 }
コード例 #26
0
ファイル: DaoBaseStub.cs プロジェクト: abaula/MixedCode
 protected DaoBaseStub(IConnectionContext connectionContext, ILogger logger)
 {
     _connectionContext = connectionContext;
     Logger             = logger;
 }
コード例 #27
0
 public ConnectionClosedState(IConnectionContext context, ErrorInfo error) :
     base(context)
 {
     this.Error = error ?? ErrorInfo.ReasonClosed;
 }
コード例 #28
0
 protected ConnectionStateBase(IConnectionContext context, ILogger logger)
 {
     Logger  = logger ?? IO.Ably.DefaultLogger.LoggerInstance;
     Context = context;
 }
コード例 #29
0
 public IRowFactory GetEntityInputRowFactory(IConnectionContext context, Func <IConnectionContext, int> capacity)
 {
     return(new RowFactory(capacity(context), context.Entity.IsMaster, false));
 }
コード例 #30
0
 public ConnectionDisconnectedState(IConnectionContext context, ILogger logger)
     : this(context, null, new CountdownTimer("Disconnected state timer", logger), logger)
 {
 }
コード例 #31
0
ファイル: Update.cs プロジェクト: shoy160/Shoy.Common
 public int Execute(IConnectionContext cc)
 {
     throw new System.NotImplementedException();
 }
コード例 #32
0
 public VelocityWriter(IConnectionContext output, IReader templateReader)
 {
     _templateReader = templateReader;
     _output         = output;
     VelocityInitializer.Init();
 }
コード例 #33
0
 static string SqlCreateKeysTable(IConnectionContext context, string tempTable) {
     var columnsAndDefinitions = string.Join(",", context.Entity.GetPrimaryKey().Select(f => "[" + f.FieldName() + "] " + f.SqlDataType() + " NOT NULL"));
     var sql = string.Format(@"CREATE TABLE #{0}({1})", tempTable, columnsAndDefinitions);
     context.Debug(sql);
     return sql;
 }
コード例 #34
0
 public ConnectionClosedState(IConnectionContext context) :
     this(context, null)
 {
 }
コード例 #35
0
 public ChatRoomVM(IConnectionContext connectionContext)
 {
     _connectionContext = connectionContext;
 }
コード例 #36
0
ファイル: SimpleList.cs プロジェクト: dsuryd/dotNetify-Blazor
 public SimpleListVM(IEmployeeRepository repository, IConnectionContext connectionContext)
 {
     _repository        = repository;
     _connectionContext = connectionContext;
 }
コード例 #37
0
 public ConnectionInitializedState(IConnectionContext context, ILogger logger) :
     base(context, logger)
 {
 }
コード例 #38
0
 static string SqlDrop(IConnectionContext context, string tempTable) {
     var sql = string.Format("DROP TABLE #{0};", tempTable);
     context.Debug(sql);
     return sql;
 }
コード例 #39
0
 public ConnectionClosingState(IConnectionContext context, ErrorInfo error, ICountdownTimer timer, ILogger logger)
     : base(context, logger)
 {
     _timer = timer;
     Error  = error ?? ErrorInfo.ReasonClosed;
 }
コード例 #40
0
 string SqlInsertTemplate(IConnectionContext context, string tempTable) {
     var sql = string.Format("INSERT #{0} VALUES ({1});", tempTable, string.Join(",", _keys.Select(k => "@" + k.FieldName())));
     context.Debug(sql);
     return sql;
 }
コード例 #41
0
 public async Task OnConnectedAsync(IConnectionContext connection)
 {
     AddConnection(connection);
     await WaitForMessagesAsync(connection).ConfigureAwait(false);
 }