Esempio n. 1
0
        internal void InvokeAsync(DatabaseActionHandler handler, object sender, IDbCommand query)
        {
            if (!RaiseEvents)
            {
                return;
            }

            if (handler != null)
            {
                if (Async && !ThreadSave && RaiseEventsAsync)
                {
                    var eventListeners = handler.GetInvocationList();
                    foreach (var t in eventListeners)
                    {
                        var methodToInvoke      = (DatabaseActionHandler)t;
                        var databaseActionEvent = new DatabaseActionEvent(query.CreateQueryDebugger(Database));
                        methodToInvoke.BeginInvoke(sender, databaseActionEvent, ar =>
                        {
                            OnHandlerRaised(databaseActionEvent, handler);
                        }, null);
                    }
                }
                else
                {
                    var eventArgs = new DatabaseActionEvent(query.CreateQueryDebugger(Database));
                    handler(sender, eventArgs);
                    OnHandlerRaised(eventArgs, handler);
                }
            }
        }
Esempio n. 2
0
        internal void RaiseFailedQuery(object sender, IDbCommand query, Exception ex)
        {
            if (!RaiseEvents)
            {
                return;
            }

            var handler = OnFailedQuery;

            if (handler != null)
            {
                if (Async && !ThreadSave)
                {
                    var eventListeners = handler.GetInvocationList();
                    foreach (var t in eventListeners)
                    {
                        var methodToInvoke = (DatabaseExceptionActionHandler)t;
                        methodToInvoke.BeginInvoke(sender, new DatabaseActionEvent(query.CreateQueryDebugger(Database)), ex, ar => { }, null);
                    }
                }
                else
                {
                    handler(sender, new DatabaseActionEvent(query.CreateQueryDebugger(Database)), ex);
                }
            }
        }
Esempio n. 3
0
		internal void RaiseSelect(IDbCommand query)
		{
			if (!RaiseEvents)
				return;
			var handler = OnSelect;
			if (handler != null)
				handler.BeginInvoke(null, new DatabaseActionEvent(query.CreateQueryDebugger(Database)), s => { }, null);
		}
Esempio n. 4
0
		internal void RaiseDelete(object sender, IDbCommand query)
		{
			if (!RaiseEvents)
				return;

			var handler = OnDelete;
			if (handler != null)
				handler.BeginInvoke(sender, new DatabaseActionEvent(query.CreateQueryDebugger(Database)), s => { }, null);
		}