DeveelDB
20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
deveeldb.git
src
deveeldb
Deveel.Data
Block.cs
Go to the documentation of this file.
1
//
2
// Copyright 2010-2015 Deveel
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
//
16
17
using
System
;
18
using
System
.Collections.Generic;
19
20
using
Deveel
.
Data
.
Diagnostics
;
21
22
namespace
Deveel
.Data {
23
public
class
Block
:
IBlock
{
24
private
IQuery
query
;
25
26
public
Block
(
IRequest
request) {
27
if
(request == null)
28
throw
new
ArgumentNullException(
"request"
);
29
30
query = request as
IQuery
;
31
32
Context
= request.
CreateBlockContext
();
33
Context
.UnregisterService<
IBlock
>();
34
Context
.RegisterInstance<
IBlock
>(
this
);
35
36
Parent = request as
IBlock
;
37
}
38
39
~Block
() {
40
Dispose(
false
);
41
}
42
43
public
IBlock
Parent {
get
;
private
set; }
44
45
public
IBlock
Next {
get
; set; }
46
47
public
IQuery
Query
{
48
get
{
49
if
(query != null)
50
return
query;
51
52
return
Parent.
Query
;
53
}
54
}
55
56
IEventSource
IEventSource
.
ParentSource
{
57
get
{
return
Parent; }
58
}
59
60
IEnumerable<KeyValuePair<string, object>>
IEventSource
.
Metadata
{
61
get
{
return
GetEventMetadata(); }
62
}
63
64
protected
virtual
IEnumerable<KeyValuePair<string, object>>
GetEventMetadata
() {
65
return
new
KeyValuePair<string, object>[0];
66
}
67
68
public
void
Dispose
() {
69
Dispose(
true
);
70
GC.SuppressFinalize(
this
);
71
}
72
73
protected
virtual
void
Dispose
(
bool
disposing) {
74
if
(disposing) {
75
if
(
Context
!= null)
76
Context
.
Dispose
();
77
}
78
79
Context
= null;
80
query = null;
81
}
82
83
public
IBlockContext
Context
{
get
;
private
set; }
84
85
IContext
IEventSource
.
Context
{
86
get
{
return
Context
; }
87
}
88
89
IBlockContext
IRequest
.
CreateBlockContext
() {
90
return
Context
.CreateBlockContext();
91
}
92
93
void
IBlock
.
Execute
(
BlockExecuteContext
context) {
94
ExecuteBlock(context);
95
}
96
97
protected
virtual
void
ExecuteBlock
(
BlockExecuteContext
context) {
98
// default implementation is an empty block, that does nothing
99
}
100
101
public
virtual
IBlock
CreateBlock
() {
102
return
new
Block
(
this
);
103
}
104
}
105
}
Deveel.Data.IRequest.CreateBlockContext
IBlockContext CreateBlockContext()
Deveel.Data.Block.CreateBlock
virtual IBlock CreateBlock()
Definition:
Block.cs:101
Deveel
System
Definition:
NonSerializedAttribute.cs:3
Deveel.Data.Query
Definition:
Query.cs:26
Deveel.Data.IBlockContext
Definition:
IBlockContext.cs:20
Deveel.Data.Context
Definition:
Context.cs:22
Deveel.Data.Context.Dispose
virtual void Dispose(bool disposing)
Definition:
Context.cs:63
Deveel.Data.Block.ExecuteBlock
virtual void ExecuteBlock(BlockExecuteContext context)
Definition:
Block.cs:97
Deveel.Data.IQuery
Definition:
IQuery.cs:20
Deveel.Data.IBlock
Definition:
IBlock.cs:20
Deveel.Data.IRequest.Query
IQuery Query
Definition:
IRequest.cs:23
Deveel.Data.Block
Definition:
Block.cs:23
Deveel.Data.Diagnostics.IEventSource.ParentSource
IEventSource ParentSource
Gets an optional parent source.
Definition:
IEventSource.cs:49
Deveel.Data.Diagnostics
Definition:
ContextExtensions.cs:19
Deveel.Data.Block.Dispose
virtual void Dispose(bool disposing)
Definition:
Block.cs:73
Deveel.Data.Diagnostics.IEventSource.Metadata
IEnumerable< KeyValuePair< string, object > > Metadata
Gets the list of metadata associated to the source.
Definition:
IEventSource.cs:57
Deveel.Data.Block.GetEventMetadata
virtual IEnumerable< KeyValuePair< string, object > > GetEventMetadata()
Definition:
Block.cs:64
Deveel.Data.Diagnostics.IEventSource.Context
IContext Context
Definition:
IEventSource.cs:41
Deveel.Data.IBlock.Execute
void Execute(BlockExecuteContext context)
Deveel.Data
Definition:
ActiveSessionList.cs:22
Deveel.Data.Block.Dispose
void Dispose()
Definition:
Block.cs:68
Deveel.Data.Block.~Block
~Block()
Definition:
Block.cs:39
Deveel.Data.Block.Block
Block(IRequest request)
Definition:
Block.cs:26
Deveel.Data.BlockExecuteContext
Definition:
BlockExecuteContext.cs:23
Deveel.Data.Block.query
IQuery query
Definition:
Block.cs:24
Deveel.Data.IRequest
Definition:
IRequest.cs:22
Deveel.Data.IContext
Definition:
IContext.cs:22
Deveel.Data.Diagnostics.IEventSource
Represents the origin of system events, providing a mechanism to fill the metadata before dispatching...
Definition:
IEventSource.cs:40
Generated by
1.8.10