Entity Framework

Entity Framework

.Entity Framework - Microsoft ORM

Web page by Kevin Harris of Homer IL

Please contact Kevin Harris of Homer IL concerning this web site

"Entity Framework allows developers to issue queries then retrieve and manipulate data as strongly typed objects. The Entity Framework's ORM implementation provides services like change tracking, identity resolution, lazy loading, and query translation so that developers can focus on their application-specific business logic rather than the data access fundamentals."



Entity Framework - Microsoft's ORM

Entity Framework (EF) is an open-source Object Relational-Mapping (ORM) framework for ADO.NET. EF enhances ADO.NET to provide developers with an automated mechanism for accessing and storing data in a database. Instead of writing lengthy SQL for database manipulation in a relational format, EF allows the use of concise, database-independent, Language Integrated Queries (LINQ) to work with the database data in the more program-appropriate form of objects. LINQ statements can be composed using either Query Syntax or Method Syntax or a combination of the two. Method syntax includes a powerful, and highly concise, form of syntax called "Lambda Expressions". See the LINQ to Entities article. EF greatly reduces the time and effort required by programmers to access databases.

ORM allows programmers to work with the relational data in a database as objects. ORMs also automate the standard CRUD operations so developers no longer need to code them manually. ORMs are commonly used with object oriented programming languages. Other popular ORM frameworks include: NHibernate, DataObjects.Net, OpenAccess, and SubSonic.

.Entity Framework Components


Entity Framework Components

The Entity Data Model contains three components:

  1. Conceptual Model - contains the model classes and their relationships.

  2. Storage Model - is the database design model (tables, views, stored procedures, keys).

  3. Mapping - contains information about the association of the conceptual model with the storage model.


Entity Framework Installation and Configuration

Entity Framework was first integrated into .NET in version 3.5 SP1 and Visual Studio 2008. Several versions later in 2012 Entity Framework 5.0 was move to open source residing on CodePlex as one of the first steps to moving the .NET framework to open source. Today Entity Framework is installed as just another one of the many packages which can be installed through the NuGet package manager.

Portions of Entity Framework's installation and configuration process depends upon the type of database being used. All the major databases provide support for Entity Framework. See the Entity Framework with MySQL in Visual Studio 2015 article for details of how to install Entity Framework 6.0 with MySQL in Visual Studio 2015. Once Entity Framework is installed, the underlying database details are abstracted away for the programmer. The same code works for all databases; these is no longer the need for database-specific SQL.


Entity Classes

As shown in the Entity Framework with MySQL in Visual Studio 2015 article, the T4 templates generate the Plain Old CLR Object (POCO) entity classes. POCO classes provide loose coupling which allows for substitutions of data sources (i.e. easier testing) and flexibility in migrations. Some of the more advance features of the entity classes are present at run time. These features include lazy loading and automatic change tracking. At runtime a dynamic proxy class of the POCO entity is created to provide the previously mentioned advance features and allow for navigation among the entities, which would previous be accomplished by coding Join statements in SQL.

.Entity Data Model Designer


Entity Data Model Designer

The Entity Data Model (EDM) Designer is used to visually create and modify entities, associations, mappings, and inheritance relationships. The EDM Designer can also be used to generate, edit, update, and validate the .edmx file. The EDM Designer works with an .edmx file, which is the combination of three metadata files:

  1. Conceptual Schema Definition Language (CSDL) - an XML-based language that describes the entities, relationships, and functions that make up a conceptual model.

  2. Store Schema Definition Language (SSDL) - is an XML-based language that describes the physical storage model (tables, views, stored procedures, keys).

  3. Mapping Specification Language (MSL) - is an XML-based language that describes the mapping relationships between the conceptual model and the physical model.


.edmx File

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="CathySiteModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.6" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
        <EntityType Name="bill">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="Payee" Type="varchar" MaxLength="45" Nullable="false" />
          <Property Name="Amount" Type="decimal" Precision="8" Scale="2" Nullable="false" />
          <Property Name="PeriodID" Type="int" Nullable="false" />
          <Property Name="Date" Type="date" Nullable="false" />
          <Property Name="Balance" Type="decimal" Precision="10" Scale="2" />
        </EntityType>
        <EntityType Name="category">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="Name" Type="varchar" MaxLength="10" Nullable="false" />
        </EntityType>
        <EntityType Name="frequency">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="Name" Type="varchar" MaxLength="45" Nullable="false" />
        </EntityType>
        <EntityType Name="grocery">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="Item" Type="varchar" MaxLength="45" Nullable="false" />
          <Property Name="Brand" Type="varchar" MaxLength="45" />
          <Property Name="Type" Type="varchar" MaxLength="20" />
          <Property Name="CategoryID" Type="int" Nullable="false" />
          <Property Name="FrequencyID" Type="int" Nullable="false" />
          <Property Name="Date" Type="date" Nullable="false" />
        </EntityType>
        <EntityType Name="page">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="Page_Name" Type="varchar" MaxLength="30" Nullable="false" />
          <Property Name="Short_Text" Type="varchar" MaxLength="15" />
          <Property Name="Medium_Text" Type="varchar" MaxLength="45" />
          <Property Name="Text1" Type="text" />
          <Property Name="Text2" Type="text" />
          <Property Name="Text3" Type="text" />
          <Property Name="Text4" Type="text" />
        </EntityType>
        <EntityType Name="period">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="Name" Type="varchar" MaxLength="10" Nullable="false" />
        </EntityType>
        <EntityType Name="permission">
          <Key>
            <PropertyRef Name="Level" />
          </Key>
          <Property Name="Level" Type="int" Nullable="false" />
          <Property Name="Permission_Name" Type="varchar" MaxLength="30" Nullable="false" />
        </EntityType>
        <EntityType Name="role">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="int" Nullable="false" />
          <Property Name="Role_Name" Type="varchar" MaxLength="45" Nullable="false" />
          <Property Name="Permission_Level" Type="int" Nullable="false" />
        </EntityType>
        <EntityType Name="user">
          <Key>
            <PropertyRef Name="User_ID" />
          </Key>
          <Property Name="User_ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
          <Property Name="User_Name" Type="varchar" MaxLength="15" Nullable="false" />
          <Property Name="Password" Type="varchar" MaxLength="15" Nullable="false" />
          <Property Name="Role_ID" Type="int" Nullable="false" />
          <Property Name="Email_Address" Type="varchar" MaxLength="30" Nullable="false" />
          <Property Name="First_Name" Type="varchar" MaxLength="30" Nullable="false" />
          <Property Name="Last_Name" Type="varchar" MaxLength="30" Nullable="false" />
        </EntityType>
        <Association Name="FKCategory">
          <End Role="category" Type="Self.category" Multiplicity="1" />
          <End Role="grocery" Type="Self.grocery" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="category">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="grocery">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FKFrequency">
          <End Role="frequency" Type="Self.frequency" Multiplicity="1" />
          <End Role="grocery" Type="Self.grocery" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="frequency">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="grocery">
              <PropertyRef Name="FrequencyID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FKPeriod">
          <End Role="period" Type="Self.period" Multiplicity="1" />
          <End Role="bill" Type="Self.bill" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="period">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="bill">
              <PropertyRef Name="PeriodID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="Fky_Permission_Level">
          <End Role="permission" Type="Self.permission" Multiplicity="1" />
          <End Role="role" Type="Self.role" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="permission">
              <PropertyRef Name="Level" />
            </Principal>
            <Dependent Role="role">
              <PropertyRef Name="Permission_Level" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="Fky_Role_ID">
          <End Role="role" Type="Self.role" Multiplicity="1" />
          <End Role="user" Type="Self.user" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="role">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="user">
              <PropertyRef Name="Role_ID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <EntityContainer Name="CathySiteModelStoreContainer">
          <EntitySet Name="bill" EntityType="Self.bill" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <EntitySet Name="category" EntityType="Self.category" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <EntitySet Name="frequency" EntityType="Self.frequency" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <EntitySet Name="grocery" EntityType="Self.grocery" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <EntitySet Name="page" EntityType="Self.page" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <EntitySet Name="period" EntityType="Self.period" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <EntitySet Name="permission" EntityType="Self.permission" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <EntitySet Name="role" EntityType="Self.role" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <EntitySet Name="user" EntityType="Self.user" Schema="mysql5_951984_cathynet1" store:Type="Tables" />
          <AssociationSet Name="FKCategory" Association="Self.FKCategory">
            <End Role="category" EntitySet="category" />
            <End Role="grocery" EntitySet="grocery" />
          </AssociationSet>
          <AssociationSet Name="FKFrequency" Association="Self.FKFrequency">
            <End Role="frequency" EntitySet="frequency" />
            <End Role="grocery" EntitySet="grocery" />
          </AssociationSet>
          <AssociationSet Name="FKPeriod" Association="Self.FKPeriod">
            <End Role="period" EntitySet="period" />
            <End Role="bill" EntitySet="bill" />
          </AssociationSet>
          <AssociationSet Name="Fky_Permission_Level" Association="Self.Fky_Permission_Level">
            <End Role="permission" EntitySet="permission" />
            <End Role="role" EntitySet="role" />
          </AssociationSet>
          <AssociationSet Name="Fky_Role_ID" Association="Self.Fky_Role_ID">
            <End Role="role" EntitySet="role" />
            <End Role="user" EntitySet="user" />
          </AssociationSet>
        </EntityContainer>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="CathySiteModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
        <EntityType Name="bill">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="Int32" Nullable="false" />
          <Property Name="Payee" Type="String" MaxLength="45" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="Amount" Type="Decimal" Nullable="false" />
          <Property Name="PeriodID" Type="Int32" Nullable="false" />
          <Property Name="Date" Type="DateTime" Nullable="false" />
          <Property Name="Balance" Type="Decimal" Nullable="false" />
          <NavigationProperty Name="period" Relationship="Self.FKPeriod" FromRole="bill" ToRole="period" />
        </EntityType>
        <EntityType Name="category">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="Name" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
          <NavigationProperty Name="groceries" Relationship="Self.FKCategory" FromRole="category" ToRole="grocery" />
        </EntityType>
        <EntityType Name="frequency">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="Name" Type="String" MaxLength="45" FixedLength="false" Unicode="false" Nullable="false" />
          <NavigationProperty Name="groceries" Relationship="Self.FKFrequency" FromRole="frequency" ToRole="grocery" />
        </EntityType>
        <EntityType Name="grocery">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="Item" Type="String" MaxLength="45" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="Brand" Type="String" MaxLength="45" FixedLength="false" Unicode="false" />
          <Property Name="Type" Type="String" MaxLength="20" FixedLength="false" Unicode="false" />
          <Property Name="CategoryID" Type="Int32" Nullable="false" />
          <Property Name="FrequencyID" Type="Int32" Nullable="false" />
          <Property Name="Date" Type="DateTime" Nullable="false" />
          <NavigationProperty Name="category" Relationship="Self.FKCategory" FromRole="grocery" ToRole="category" />
          <NavigationProperty Name="frequency" Relationship="Self.FKFrequency" FromRole="grocery" ToRole="frequency" />
        </EntityType>
        <EntityType Name="page">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="Page_Name" Type="String" MaxLength="30" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="Short_Text" Type="String" MaxLength="15" FixedLength="false" Unicode="false" />
          <Property Name="Medium_Text" Type="String" MaxLength="45" FixedLength="false" Unicode="false" />
          <Property Name="Text1" Type="String" MaxLength="65535" FixedLength="false" Unicode="false" />
          <Property Name="Text2" Type="String" MaxLength="65535" FixedLength="false" Unicode="false" />
          <Property Name="Text3" Type="String" MaxLength="65535" FixedLength="false" Unicode="false" />
          <Property Name="Text4" Type="String" MaxLength="65535" FixedLength="false" Unicode="false" />
        </EntityType>
        <EntityType Name="period">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="Name" Type="String" MaxLength="10" FixedLength="false" Unicode="false" Nullable="false" />
          <NavigationProperty Name="bills" Relationship="Self.FKPeriod" FromRole="period" ToRole="bill" />
        </EntityType>
        <EntityType Name="permission">
          <Key>
            <PropertyRef Name="Level" />
          </Key>
          <Property Name="Level" Type="Int32" Nullable="false" />
          <Property Name="Permission_Name" Type="String" MaxLength="30" FixedLength="false" Unicode="false" Nullable="false" />
          <NavigationProperty Name="roles" Relationship="Self.Fky_Permission_Level" FromRole="permission" ToRole="role" />
        </EntityType>
        <EntityType Name="role">
          <Key>
            <PropertyRef Name="ID" />
          </Key>
          <Property Name="ID" Type="Int32" Nullable="false" />
          <Property Name="Role_Name" Type="String" MaxLength="45" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="Permission_Level" Type="Int32" Nullable="false" />
          <NavigationProperty Name="permission" Relationship="Self.Fky_Permission_Level" FromRole="role" ToRole="permission" />
          <NavigationProperty Name="users" Relationship="Self.Fky_Role_ID" FromRole="role" ToRole="user" />
        </EntityType>
        <EntityType Name="user">
          <Key>
            <PropertyRef Name="User_ID" />
          </Key>
          <Property Name="User_ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
          <Property Name="User_Name" Type="String" MaxLength="15" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="Password" Type="String" MaxLength="15" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="Role_ID" Type="Int32" Nullable="false" />
          <Property Name="Email_Address" Type="String" MaxLength="30" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="First_Name" Type="String" MaxLength="30" FixedLength="false" Unicode="false" Nullable="false" />
          <Property Name="Last_Name" Type="String" MaxLength="30" FixedLength="false" Unicode="false" Nullable="false" />
          <NavigationProperty Name="role" Relationship="Self.Fky_Role_ID" FromRole="user" ToRole="role" />
        </EntityType>
        <Association Name="FKPeriod">
          <End Role="period" Type="Self.period" Multiplicity="1" />
          <End Role="bill" Type="Self.bill" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="period">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="bill">
              <PropertyRef Name="PeriodID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FKCategory">
          <End Role="category" Type="Self.category" Multiplicity="1" />
          <End Role="grocery" Type="Self.grocery" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="category">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="grocery">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FKFrequency">
          <End Role="frequency" Type="Self.frequency" Multiplicity="1" />
          <End Role="grocery" Type="Self.grocery" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="frequency">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="grocery">
              <PropertyRef Name="FrequencyID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="Fky_Permission_Level">
          <End Role="permission" Type="Self.permission" Multiplicity="1" />
          <End Role="role" Type="Self.role" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="permission">
              <PropertyRef Name="Level" />
            </Principal>
            <Dependent Role="role">
              <PropertyRef Name="Permission_Level" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="Fky_Role_ID">
          <End Role="role" Type="Self.role" Multiplicity="1" />
          <End Role="user" Type="Self.user" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="role">
              <PropertyRef Name="ID" />
            </Principal>
            <Dependent Role="user">
              <PropertyRef Name="Role_ID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <EntityContainer Name="CathySiteEntities" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="bills" EntityType="Self.bill" />
          <EntitySet Name="categories" EntityType="Self.category" />
          <EntitySet Name="frequencies" EntityType="Self.frequency" />
          <EntitySet Name="groceries" EntityType="Self.grocery" />
          <EntitySet Name="pages" EntityType="Self.page" />
          <EntitySet Name="periods" EntityType="Self.period" />
          <EntitySet Name="permissions" EntityType="Self.permission" />
          <EntitySet Name="roles" EntityType="Self.role" />
          <EntitySet Name="users" EntityType="Self.user" />
          <AssociationSet Name="FKPeriod" Association="Self.FKPeriod">
            <End Role="period" EntitySet="periods" />
            <End Role="bill" EntitySet="bills" />
          </AssociationSet>
          <AssociationSet Name="FKCategory" Association="Self.FKCategory">
            <End Role="category" EntitySet="categories" />
            <End Role="grocery" EntitySet="groceries" />
          </AssociationSet>
          <AssociationSet Name="FKFrequency" Association="Self.FKFrequency">
            <End Role="frequency" EntitySet="frequencies" />
            <End Role="grocery" EntitySet="groceries" />
          </AssociationSet>
          <AssociationSet Name="Fky_Permission_Level" Association="Self.Fky_Permission_Level">
            <End Role="permission" EntitySet="permissions" />
            <End Role="role" EntitySet="roles" />
          </AssociationSet>
          <AssociationSet Name="Fky_Role_ID" Association="Self.Fky_Role_ID">
            <End Role="role" EntitySet="roles" />
            <End Role="user" EntitySet="users" />
          </AssociationSet>
        </EntityContainer>
      </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="CathySiteModelStoreContainer" CdmEntityContainer="CathySiteEntities">
          <EntitySetMapping Name="bills">
            <EntityTypeMapping TypeName="CathySiteModel.bill">
              <MappingFragment StoreEntitySet="bill">
                <ScalarProperty Name="ID" ColumnName="ID" />
                <ScalarProperty Name="Payee" ColumnName="Payee" />
                <ScalarProperty Name="Amount" ColumnName="Amount" />
                <ScalarProperty Name="PeriodID" ColumnName="PeriodID" />
                <ScalarProperty Name="Date" ColumnName="Date" />
                <ScalarProperty Name="Balance" ColumnName="Balance" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="categories">
            <EntityTypeMapping TypeName="CathySiteModel.category">
              <MappingFragment StoreEntitySet="category">
                <ScalarProperty Name="ID" ColumnName="ID" />
                <ScalarProperty Name="Name" ColumnName="Name" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="frequencies">
            <EntityTypeMapping TypeName="CathySiteModel.frequency">
              <MappingFragment StoreEntitySet="frequency">
                <ScalarProperty Name="ID" ColumnName="ID" />
                <ScalarProperty Name="Name" ColumnName="Name" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="groceries">
            <EntityTypeMapping TypeName="CathySiteModel.grocery">
              <MappingFragment StoreEntitySet="grocery">
                <ScalarProperty Name="ID" ColumnName="ID" />
                <ScalarProperty Name="Item" ColumnName="Item" />
                <ScalarProperty Name="Brand" ColumnName="Brand" />
                <ScalarProperty Name="Type" ColumnName="Type" />
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="FrequencyID" ColumnName="FrequencyID" />
                <ScalarProperty Name="Date" ColumnName="Date" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="pages">
            <EntityTypeMapping TypeName="CathySiteModel.page">
              <MappingFragment StoreEntitySet="page">
                <ScalarProperty Name="ID" ColumnName="ID" />
                <ScalarProperty Name="Page_Name" ColumnName="Page_Name" />
                <ScalarProperty Name="Short_Text" ColumnName="Short_Text" />
                <ScalarProperty Name="Medium_Text" ColumnName="Medium_Text" />
                <ScalarProperty Name="Text1" ColumnName="Text1" />
                <ScalarProperty Name="Text2" ColumnName="Text2" />
                <ScalarProperty Name="Text3" ColumnName="Text3" />
                <ScalarProperty Name="Text4" ColumnName="Text4" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="periods">
            <EntityTypeMapping TypeName="CathySiteModel.period">
              <MappingFragment StoreEntitySet="period">
                <ScalarProperty Name="ID" ColumnName="ID" />
                <ScalarProperty Name="Name" ColumnName="Name" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="permissions">
            <EntityTypeMapping TypeName="CathySiteModel.permission">
              <MappingFragment StoreEntitySet="permission">
                <ScalarProperty Name="Level" ColumnName="Level" />
                <ScalarProperty Name="Permission_Name" ColumnName="Permission_Name" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="roles">
            <EntityTypeMapping TypeName="CathySiteModel.role">
              <MappingFragment StoreEntitySet="role">
                <ScalarProperty Name="ID" ColumnName="ID" />
                <ScalarProperty Name="Role_Name" ColumnName="Role_Name" />
                <ScalarProperty Name="Permission_Level" ColumnName="Permission_Level" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="users">
            <EntityTypeMapping TypeName="CathySiteModel.user">
              <MappingFragment StoreEntitySet="user">
                <ScalarProperty Name="User_ID" ColumnName="User_ID" />
                <ScalarProperty Name="User_Name" ColumnName="User_Name" />
                <ScalarProperty Name="Password" ColumnName="Password" />
                <ScalarProperty Name="Role_ID" ColumnName="Role_ID" />
                <ScalarProperty Name="Email_Address" ColumnName="Email_Address" />
                <ScalarProperty Name="First_Name" ColumnName="First_Name" />
                <ScalarProperty Name="Last_Name" ColumnName="Last_Name" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
        </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
    <Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </Connection>
    <Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
        <DesignerProperty Name="EnablePluralization" Value="true" />
        <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
        <DesignerProperty Name="UseLegacyProvider" Value="false" />
        <DesignerProperty Name="CodeGenerationStrategy" Value="None" />
      </DesignerInfoPropertySet>
    </Options>
    <!-- Diagram content (shape and connector positions) -->
    <Diagrams></Diagrams>
  </Designer>
</edmx:Edmx>


.edmx File Open in XML Editor