CSLA.NET
6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
Silverlight/Server/DataPortal/PrimitiveCriteriaSingle.cs
Go to the documentation of this file.
1
//-----------------------------------------------------------------------
2
// <copyright file="PrimitiveCriteriaSingle.cs" company="Marimer LLC">
3
// Copyright (c) Marimer LLC. All rights reserved.
4
// Website: https://cslanet.com
5
// </copyright>
6
// <summary>no summary</summary>
7
//-----------------------------------------------------------------------
8
using
System.Collections.Generic;
9
using
System.Text;
10
11
using
Csla
;
12
using
System;
13
using
Csla
.
Core
;
14
15
namespace
Csla.Test.DataPortalTest
16
{
17
#if TESTING
18
[System.Diagnostics.DebuggerNonUserCode]
19
#endif
20
[
Serializable
]
21
public
class
PrimitiveCriteriaSingle :
BusinessBase
<PrimitiveCriteriaSingle>
22
{
23
#region Business Methods
24
25
public
static
readonly
PropertyInfo<int>
IdProperty
= RegisterProperty<int>(c => c.Id);
26
public
int
Id
27
{
28
get
{
return
GetProperty(
IdProperty
); }
29
set
{ SetProperty(
IdProperty
, value); }
30
}
31
32
private
static
PropertyInfo<string>
MethodCalledProperty = RegisterProperty<string>(c => c.MethodCalled);
33
public
string
MethodCalled
34
{
35
get
{
return
GetProperty(MethodCalledProperty); }
36
set
{ SetProperty(MethodCalledProperty, value); }
37
}
38
39
protected
override
object
GetIdValue
()
40
{
41
return
Id
;
42
}
43
44
#endregion
45
46
public
PrimitiveCriteriaSingle
()
47
{ }
48
49
#region Data Access
50
51
#region DataPortal_Create
52
53
protected
void
DataPortal_Create
(
int
id
)
54
{
55
DoCreate(
id
);
56
}
57
58
private
void
DoCreate(
int
id
)
59
{
60
Id
= id;
61
#pragma warning disable CS0618
// Type or member is obsolete
62
ApplicationContext
.GlobalContext.
Clear
();
63
ApplicationContext
.GlobalContext.Add(
"PrimitiveCriteriaSingle"
,
"Created"
);
64
#pragma warning restore CS0618
// Type or member is obsolete
65
MethodCalled
=
"Created"
;
66
if
(
id
== 9999)
67
throw
new
Exception(
"Bad data"
);
68
}
69
70
#endregion
71
72
#region DataPortal_Fetch
73
74
75
private
void
DataPortal_Fetch(
int
id
)
76
{
77
DoFetch(
id
);
78
}
79
80
private
void
DataPortal_Fetch(
string
id
)
81
{
82
DoFetch(
int
.Parse(
id
));
83
}
84
85
private
void
DataPortal_Fetch(Guid
id
)
86
{
87
DoFetch(1234);
88
}
89
90
private
void
DoFetch(
int
id
)
91
{
92
Id
= id;
93
#pragma warning disable CS0618
// Type or member is obsolete
94
ApplicationContext
.GlobalContext.
Clear
();
95
ApplicationContext
.GlobalContext.Add(
"PrimitiveCriteriaSingle"
,
"Fetched"
);
96
#pragma warning restore CS0618
// Type or member is obsolete
97
MethodCalled
=
"Fetched"
;
98
if
(
id
== 9999)
99
throw
new
Exception(
"Bad data"
);
100
}
101
102
#endregion
103
104
#region DataPortal_Insert / DataPortal_Update / DataPortal_Delete
105
106
[Insert]
107
protected
void
DataPortal_Insert
()
108
{
109
DoInsertUpdate(
false
);
110
}
111
112
private
void
DoInsertUpdate(
bool
isUpdate)
113
{
114
var insertOrUpdate = isUpdate ?
"Updated"
:
"Inserted"
;
115
116
#pragma warning disable CS0618
// Type or member is obsolete
117
ApplicationContext
.GlobalContext.
Clear
();
118
ApplicationContext
.GlobalContext.Add(
"PrimitiveCriteriaSingle"
, insertOrUpdate);
119
#pragma warning restore CS0618
// Type or member is obsolete
120
MethodCalled
= insertOrUpdate;
121
}
122
123
124
125
#endregion
126
127
128
[
Delete
]
129
private
void
DataPortal_Delete(
int
id
)
130
{
131
#pragma warning disable CS0618
// Type or member is obsolete
132
ApplicationContext
.GlobalContext.
Clear
();
133
ApplicationContext
.GlobalContext.Add(
"PrimitiveCriteriaSingle"
,
"Deleted"
);
134
#pragma warning restore CS0618
// Type or member is obsolete
135
MethodCalled
=
"Deleted+"
+
id
.ToString();
136
}
137
138
#endregion
139
}
140
}
Csla.ApplicationContext
Provides consistent context information between the client and server DataPortal objects.
Definition:
ApplicationContext.cs:22
Csla.ApplicationContext.Clear
void Clear()
Clears all context collections.
Definition:
ApplicationContext.cs:142
Csla.BusinessBase
This is the base class from which most business objects will be derived.
Definition:
BusinessBase.cs:38
Csla.PropertyInfo
Maintains metadata about a property.
Definition:
Csla/PropertyInfo.cs:22
Csla.Test.DataPortalTest.PrimitiveCriteriaSingle.IdProperty
static readonly PropertyInfo< int > IdProperty
Definition:
Fakes/Server/DataPortal/PrimitiveCriteriaSingle.cs:25
Csla.Test.DataPortalTest.PrimitiveCriteriaSingle.Id
int Id
Definition:
Fakes/Server/DataPortal/PrimitiveCriteriaSingle.cs:27
Csla.Test.DataPortalTest.PrimitiveCriteriaSingle.MethodCalled
string MethodCalled
Definition:
Fakes/Server/DataPortal/PrimitiveCriteriaSingle.cs:34
Csla.Test.DataPortalTest.PrimitiveCriteriaSingle.PrimitiveCriteriaSingle
PrimitiveCriteriaSingle()
Definition:
Silverlight/Server/DataPortal/PrimitiveCriteriaSingle.cs:46
Csla.Test.DataPortalTest.PrimitiveCriteriaSingle.DataPortal_Insert
void DataPortal_Insert()
Definition:
Silverlight/Server/DataPortal/PrimitiveCriteriaSingle.cs:107
Csla.Test.DataPortalTest.PrimitiveCriteriaSingle.DataPortal_Create
void DataPortal_Create(int id)
Definition:
Silverlight/Server/DataPortal/PrimitiveCriteriaSingle.cs:53
Csla.Test.DataPortalTest.PrimitiveCriteriaSingle.GetIdValue
override object GetIdValue()
Override this method to return a unique identifying value for this object.
Definition:
Silverlight/Server/DataPortal/PrimitiveCriteriaSingle.cs:39
Csla.Core
Definition:
AddedNewEventArgs.cs:11
Csla.Test.DataPortalTest
Definition:
Legacy.cs:13
Csla
Definition:
BusinessRuleCases.cs:5
Csla.TransactionIsolationLevel.Serializable
@ Serializable
Prevents updating or inserting until the transaction is complete.
Csla.DataPortalOperations.Delete
@ Delete
Delete operation.
Generated by
1.9.2