Summary: This document provides basic information about the extension providing Entity Framework support for C#. |
com.castsoftware.entity
See Entity Framework 2.0 - Release Notes for more information.
This extension provides support for Entity Framework. The calculation of Automated Function Points for your .NET analyses will be supplemented through the links between objects produced by the base .NET Analyzer and database tables, using Entity Framework CRUD operations.
If your .NET application contains Entity Framework source code and you want to view these object types and their links, then you should install this extension. More specifically the extension will identify:
Entity Framework is delivered with the .NET Framework. Therefore the following .NET frameworks are supported by this extension:
Version | Supported |
---|---|
3.0 and above |
Version | Supported |
---|---|
3.x | |
2.x | |
1.x |
Function Points (transactions) | |
---|---|
Quality and Sizing |
CAST AIP release | Supported | Supported Technology |
---|---|---|
8.3.x | C# |
This extension is compatible with the following DBMS servers:
DBMS | Supported |
---|---|
CSS/PostgreSQL | |
Oracle | |
Microsoft SQL Server |
An installation of any compatible release of CAST AIP (see table above) |
Include the extension using the interface in AIP Console:
There is nothing further to do. Follow the instructions below to run a new analysis/snapshot to generate new results:
Once the analysis/snapshot generation has completed, you can view the results in the normal manner. The following links will be displayed in CAST Enlighten:
Link type | Source and destination of link | Methods supported |
---|---|---|
useInsertLink | Between the caller .NET Class / Method objects and Database Table object |
|
useDeleteLink | Between the caller .NET Class / Method objects and Database Table object |
|
useUpdateLink | Between the caller .NET Class / Method objects and Database Table object |
|
useSelectLink | Between the caller .NET Class / Method objects and Database Table object |
|
public void AddNewContractor() { var contractor = ModelFakes.ContractorFake.Generate(); var vendor = dbContext.Vendor.FirstOrDefault(); contractor.VendorId = vendor.Id; dbContext.Contractor.Add(contractor); dbContext.SaveChanges(); Assert.AreNotEqual(0, contractor.Id); } |
protected override void Seed(Hth.Aepollon.Data.BackendDataAccess.AepollonContext context) { var listRefdefaut = context.RefDefauts.ToList(); foreach (var refDef in listRefdefaut) { context.MatriceDemerits.AddOrUpdate( new MatriceDemerit { idModeOperatoire = 1, idRefDefaut = refDef.idRefDefaut, idTailleDefaut = 1, PointsDemerit = 1, PointsDemeritLineaire = 1, Tare = (decimal)0.05 }, new MatriceDemerit { idModeOperatoire = 1, idRefDefaut = refDef.idRefDefaut, idTailleDefaut = 2, PointsDemerit = 3, PointsDemeritLineaire = 3, Tare = (decimal)0.20 }, new MatriceDemerit { idModeOperatoire = 1, idRefDefaut = refDef.idRefDefaut, idTailleDefaut = 3, PointsDemerit = 5, PointsDemeritLineaire = 5, Tare = (decimal)0.50 }); } context.SaveChanges(); } |
public void RemoveEntry() { var rec = dbContext.Contractor.FirstOrDefault(); dbContext.Contractor.Remove(rec); dbContext.SaveChanges(); } |
public void UpdateContractorAddress() { var contractor = dbContext.Contractor.FirstOrDefault(); contractor.Address = ModelFakes.ContractorFake.Generate().Address; dbContext.Contractor.Update(contractor); dbContext.SaveChanges(); } |
public void FindEntry(int id) { var rec = dbContext.Vendor.Find(id); dbContext.SaveChanges(); } |
public static void LinqToEntitiesQueries() { using (var context = new SchoolDBEntities()) { //Retrieve students whose name is Bill - Linq-to-Entities Query Syntax var students = (from s in context.Students where s.StudentName == "Bill" select s).ToList(); //Retrieve students with the same name - Linq-to-Entities Method Syntax var studentsWithSameName = context.Students .GroupBy(s => s.StudentName) .Where(g => g.Count() > 1) .Select(g => g.Key); } } |
EntityModelConfiguration allows configuration to be performed for any entity type in a model. Support has be been provided to create links between method and table, when table name is overridden through EntityModelConfiguration.
|