The document summarizes a presentation about building a real world MVC web application called Aphirm.it that allows users to share affirmations. The presentation covers using Entity Framework to interact with the database, implementing user registration and authentication, uploading images, and using AJAX and JavaScript for features like live updating. It also discusses implementing administration functionality like approving content, assigning badges to users, and sending tweets when new content is added.
jQuery is the new favorite of web developers. This lightweight JavaScript library makes developers love writing JavaScript code again! What needed 20 lines of code first is now reduced to 3 lines. Who wouldn’t be enthusiastic?! Microsoft showed its love for the library by fully integrating it in Visual Studio. I dare to ask: Should you stay behind? In this session, we’ll take a look at jQuery and we’ll teach you what you need to know to get on your way. More specifically, we’ll look at selectors, attributes, working with WCF, jQuery UI and much more. You may walk out of this session wearing a sticker: “I love jQuery”!
jQuery is the new favorite of web developers. This lightweight JavaScript library makes developers love writing JavaScript code again! What needed 20 lines of code first is now reduced to 3 lines. Who wouldn’t be enthusiastic?! Microsoft showed its love for the library by fully integrating it in Visual Studio. I dare to ask: Should you stay behind? In this session, we’ll take a look at jQuery and we’ll teach you what you need to know to get on your way. More specifically, we’ll look at selectors, attributes, working with WCF, jQuery UI and much more. You may walk out of this session wearing a sticker: “I love jQuery”!
Http4s, Doobie and Circe: The Functional Web StackGaryCoady
Http4s, Doobie and Circe together form a nice platform for building web services. This presentations provides an introduction to using them to build your own service.
Spring Data Requery is alternatives of Spring Data JPA
Requery is lightweight ORM for DBMS (MySQL, PostgreSQL, H2, SQLite, Oracle, SQL Server)
Spring Data Requery provide Query By Native Query, Query By Example and Query By Property like Spring Data JPA
Spring Data Requery is better performance than JPA
Getting the most out of Java [Nordic Coding-2010]Sven Efftinge
In this talk we explain how we use the more recent concepts of the Java programming language in order to improve readability and maintainability of our code.
Nothing Hard Baked: Designing the Inclusive Webcolinbdclark
We've all experienced the frustration and exclusion of using an application that is awkwardly designed or poorly suited to our preferred device. In this talk, I redefine accessibility as a usability problem, exploring some of the limitations we've inherited from traditional, desktop-centric approaches to accessibility and user interface design. I also show a few of the techniques used in Fluid Infusion to support open web user interfaces that can more readily adapt to the needs of both developers and end-users alike.
In building large scale web applications MVC seems like a good solution in the initial design phase. However after having built a few large apps that have multiple entry points (web, cli, api etc) you start to find that MVC breaks down. Start using Domain Driven Design.
Domain-driven design (DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model.[1] The premise of domain-driven design is the following:
Placing the project's primary focus on the core domain and domain logic.
Basing complex designs on a model of the domain.
Initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems.
Have more questions?
Twitter: @wajrcs
Web: http://waqaralamgir.tk
Learn about how object-relational mapping works to provide data access and understand what the Entity Framework is and how it can provide robust data access services to applications.
Http4s, Doobie and Circe: The Functional Web StackGaryCoady
Http4s, Doobie and Circe together form a nice platform for building web services. This presentations provides an introduction to using them to build your own service.
Spring Data Requery is alternatives of Spring Data JPA
Requery is lightweight ORM for DBMS (MySQL, PostgreSQL, H2, SQLite, Oracle, SQL Server)
Spring Data Requery provide Query By Native Query, Query By Example and Query By Property like Spring Data JPA
Spring Data Requery is better performance than JPA
Getting the most out of Java [Nordic Coding-2010]Sven Efftinge
In this talk we explain how we use the more recent concepts of the Java programming language in order to improve readability and maintainability of our code.
Nothing Hard Baked: Designing the Inclusive Webcolinbdclark
We've all experienced the frustration and exclusion of using an application that is awkwardly designed or poorly suited to our preferred device. In this talk, I redefine accessibility as a usability problem, exploring some of the limitations we've inherited from traditional, desktop-centric approaches to accessibility and user interface design. I also show a few of the techniques used in Fluid Infusion to support open web user interfaces that can more readily adapt to the needs of both developers and end-users alike.
In building large scale web applications MVC seems like a good solution in the initial design phase. However after having built a few large apps that have multiple entry points (web, cli, api etc) you start to find that MVC breaks down. Start using Domain Driven Design.
Domain-driven design (DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model.[1] The premise of domain-driven design is the following:
Placing the project's primary focus on the core domain and domain logic.
Basing complex designs on a model of the domain.
Initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems.
Have more questions?
Twitter: @wajrcs
Web: http://waqaralamgir.tk
Learn about how object-relational mapping works to provide data access and understand what the Entity Framework is and how it can provide robust data access services to applications.
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...dotNet Miami
dotNet Miami - June 21, 2012: Presented by Richie Rump: Traditionally, Entity Framework has used a designer and XML files to define the conceptual and storage models. Now with Entity Framework Code First we can ditch the XML files and define the data model directly in code. This session will give an overview of all of the awesomeness that is Code First including Data Annotations, Fluent API, DbContext and the new Migrations feature. Be prepared for a fast moving and interactive session filled with great information on how to access your data.
Mobile applications Development - Lecture 13
Local/Session Storage
WebSQL
IndexedDB
File System Access
This presentation has been developed in the context of the Mobile Applications Development course at the Computer Science Department of the University of L’Aquila (Italy).
http://www.di.univaq.it/malavolta
Introduction
Web Storage
WebSQL
IndexedDB
File System Access
Final Considerations
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2015.
http://www.ivanomalavolta.com
Introduction
Web Storage
WebSQL
IndexedDB
File System Access
Final Considerations
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2014.
http://www.ivanomalavolta.com
Prairie DevCon 2015 - Crafting Evolvable API Responsesdarrelmiller71
Web frameworks help you build an API quickly but most have little support for dealing with an API that needs to evolve, forcing you to prematurely version your API. But many industry professionals are telling us not to version. How can we avoid it? Take back control of the content you send over the wire. API responses are the "user interface" of your API and should be crafted with same attention to detail that cause designers to fret over color choices, shadows and highlights. In this talk I’ll show techniques that can be used to build responses that are easier to evolve and highlight the types of practices that encourage breaking changes and force you to version your API.
In a world where users have ever higher expectations from the apps they use, having data always available, even when the device is offline has become increasingly important.
In this talk we will go through different ways of saving data on the phone and introduce Realm as a replacement for SQLite and ORM's.
Through an example app it will be demonstrated that thinking "Offline first" not only affects your apps architecture for the better, but also results in happier users.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Real World MVC
1. A Real World MVC Application
with some other groovy stuff thrown in
James Johnson
Developer Advocates
Los Angeles C# User Group
Tuesday, November 1, 2011
2. Who I am
Founder and President of the Inland Empire .NET User’s Group
Three time and current Microsoft MVP – CAD
Software developer by day
Serial netrepreneur by night
Partner in Developer Advocates
Easily distracted by acronyms and shiny objects
3. Developer Advocates
Helping small to medium size software companies through
• Evangelism and Advocacy
• Blog Articles
• Webcasts
• Presentations
• User group meetings
• Code Camps
• Regional Tech Conferences
4. Agenda
• Demo of web site
• Comparing Web Forms to MVC
• Entity Framework
• Administration
• Bad words
• Uploading images
• Ajax and JavaScript
• Ratings
• Paging
• Searching
• Tweeting
5. Aphirm.it
• New thought and spiritual affirmations
• Always have been a new thinker and hippie
• Sister site to Windows Phone 7 app
• Some bad words will be shown for the demo
7. ASP.NET MVC
• Models
• Views
• Controllers
• ViewModels
• No Postbacks
• Very limited use of existing server controls
• Clean HTML makes CSS and JavaScript easier
• What all the cool kids are using these days
10. Entity Framework
• Version 4 released with .NET 4.0
• New version (4.1) allows for model-first, code-first or
database-first development
• Maps POCO objects to database objects
• A collection of things instead of a dataset of rows
• “things” are the entities
11. Entity Framework
• Why?
• Adds a layer of abstraction between database and code
• DBA can structure database how they want
• Developer can map to the database how they want
• Rename entities for more comfortable use
• Entity Framework handles the mappings
12. Entity Framework
• Entity Data Model – EDM
• Deals with the entities and relationships they use
• Entities
• Instance of EntityType
• Represent individual instances of the objects
• Customer, book, shoe, aphirmit
• Fully typed
• Relationships between look up tables are mapped as
associations in the EDMX
13. Entity Framework
• csdl
• Conceptual Schema Definition Language
• The conceputal schema for the EDM
• EntityContainer, EntitySet, EntityType definitions
• ssdl
• Store Schema Definition Language
• Schematic representation of the data store
• msl
• Mapping Specification Language
• Sits between the csdl and ssld and maps the entity
properties
14. Entity Framework
Lazy Loading
A design pattern to defer initialization until needed
context.ContextOptions.DeferredLoadingEnabled=true;
List<BookCase> cases = context.BookCase.ToList();
foreach(var bookcase in cases)
{
var books = bookcase.Books;
}
15. Entity Framework
Eager Loading
Use if you will be needing every related entity
List<BookCase> cases =
context.BookCase.Include(“Books”).ToList();
foreach(var bookcase in cases)
{
var books = bookcase.Books;
}
16. Entity Framework
Contexts
• The context is the instance of the entity
• Passing an entity around to tiers breaks the context
• Just like the song, make sure the context remains the same
17. Entity Framework
Contexts
public class ModelHelper
{
private static CourseEntities _db;
public static CourseEntities CourseEntities
{
get
{
if(_db == null)
_db = new CourseEntities();
return _db;
}
set { _db = value; }
}
}
private readonly CourseEntities _db = new CourseEntities();
18. Entity Framework
Contexts
private Student AddStudent(Student student, Course course)
{
student.Courses.Add(course);
_db.SaveChanges();
}
Didn’t work because course was in a different context
private Student AddStudent(Student student, Course course)
{
var newStudent = GetStudent(student.Id);
var newCourse = GetCourse(course.Id);
newStudent.Courses.Add(newCourse);
_db.SaveChanges();
}
19. Entity Framework
LINQ to Entities
• Very similar to LINQ to SQL
• Major difference
LINQ to SQL – SingleOrDefault()
LINQ to Entities – FirstOrDefault()
21. Entity Framework
LINQ to Entities
Adding (Inserting)
public void AddThing(Thing thing)
{
_db.AddToThings(thing) //this will be a list
_db.SaveChanges() // of AddTo<Entities>
}
Editing (Updating)
public void EditThing(Thing thing)
{
_db.Things.Attach(new Thing{Id=thing.Id});
_db.Things.ApplyCurrentValues(thing);
_db.SaveChanges();
}
22. Entity Framework
Repositories
• Repository pattern encapsulates code into a separate class
• Allows for easy changes
• Can use it to swith database providers or new technologies
• Stephen Walther – ASP.NET MVC Framework, Sams
• stephenwalther.com
• “Download the code” link
• Add the two projects to your solution
• Add references to your project
23. Entity Framework
Repositories
using GenericRepository
public class MyController
{
private readonly IGenericRepository _repo;
private readonly CourseEntities _db;
public MyController()
{
_repo = new
EFGenericRepository.EFGenericRepository(_db);
}
}
24. Entity Framework
Repositories
// get
_repo.Get<Thing>(id);
// edit
_repo.Edit(thing);
// create
_repo.Create(thing);
// delete
_repo.Delete(thing);
// list
var list = _repo.List<Thing>().Where(x =>
x.Name.Contains(myName));
25. Aphirm.it
• New thought and spiritual affirmations
• Always have been a new thinker and hippie
• Sister site to Windows Phone 7 app
• Some bad words will be shown for the demo
26. Aphirm.it
• Administration
• Approve aphirm.its
• Set IsApproved to true
• Send email to user
• Check for badges
• Tweet new aphirm.it
27. Aphirm.it
SetBadges
public void SetBadges(Aphirmit affirmation)
{
var memberId = affirmation.MemberId;
_db.ResetPostBadges(memberId); //SP in database
//get all the aphirmations the user has created
var aphList =
_aphirmitHelper.GetAphirmitsByMember(memberId)
.Where(x => x.IsApproved.Equals(true)).ToList();
var aphCount = aphList.Count;
if (aphCount >= 0) //beginner
AddPostBadge(100, memberId);
}
28. Aphirm.it
AddPostBadge
private void AddPostBadge(int badgeId, int memberId)
{
// BadgeIdis the internal Id
varbadge = _db.Badges.Single(x => x.BadgeId.Equals(badgeId));
varnewBadge = new MemberBadge()
{ MemberId = memberId,
BadgeId = badge.Id
};
_db.AddToMemberBadges(newBadge);
_db.SaveChanges();
}
30. Aphirm.it
Uploading Images
[HttpPost]
public ActionResult
UploadAvatar(IEnumerable<HttpPostedFileBase> attachments)
{
if (attachments == null)
return Content("no file was uploaded");
HttpPostedFileBase img = attachments.ElementAt(0);
var imagePath = _generalHelper.UploadAvatar(img);
return Json(new { status = imagePath }, "text/plain");
}
31. Aphirm.it
Uploading Images
function onSelect(e) {
var extArray = new Array(".png", ".gif", ".jpg", ".jpeg");
var $status = $("div.status");
$status.hide();
var file = e.files[0];
var inArray = $.inArray(file.extension, extArray);
if (inArray == -1) {
$("div.status").html("Sorry, only PNG, GIF, or JPG
images are allowed.").show();
e.preventDefault();
return false;
}
}
32. Aphirm.it
Uploading Images
function onAvatarComplete() {
var userName = $("#avatarPath").val();
var url = "/Profile/GetMemberAvatar/" + userName;
$.getJSON(url, function (json) {
//append something to the string so that the image will be
refreshed.
json = json + "?" + new Date();
$("#memberAvatar").attr("src", json);
});
}
33. Aphirm.it
User Registration
• Be as minimal as possible
• Don’t ask for all possible data at start
• Go easy, can always come back for more
34. Aphirm.it
User Registration
• Use Ajax/JavaScript to help the user
• Check for existing username before submitting
• Check for existing email and format
35. Aphirm.it
Ajax/JavaScript
Validate username
function validateUserName(elem) {
var $elem = $(elem);
var userName = $elem.val();
$elem.attr("valid", true);
var url = "/Account/IsExistingUser/";
$.get(url, { name: userName }, function (json) {
if (json) {
$("#userNameTaken").fadeIn();
$elem.attr("valid",
false).removeClass("valid").addClass("invalid");
} else {
$("#userNameTaken").fadeOut();
$elem.removeClass("invalid").addClass("valid");
}
});
}
37. Aphirm.it
Paging
• Use paging when there is more data than can easily be viewed
• Easy to add page to display
• There are several jQuery grids available
• I just like mine
38. Aphirm.it
Paging
[HttpGet]
public ActionResult All(int? id)
{
int pageIndex;
if (id == null)
pageIndex = 0;
else
pageIndex = (int)id - 1;
var pageSize = _generalHelper.GetListSize();
var affirmationList =
_affirmationHelper.GetAphirmitRange(pageIndex, pageSize);
decimal totalAffirmations = _affirmationHelper.GetApprovedCount();
var pageNumbers = Math.Ceiling(totalAffirmations / pageSize);
ViewBag.PageNumbers = pageNumbers;
ViewBag.CurrentPage = pageIndex;
ViewBag.ListCount = pageSize;
ViewBag.Total = totalAffirmations;
return View("View", affirmationList);
39. Aphirm.it
Bad Words
Need to check text for any bad words the user may have used
var status = false;
var badWords = _repo.List<BadWord>().ToList();
foreach (var bWord in badWords.Where(bWord =>
aphirmit.Text.IndexOf(bWord.Word) > -1))
{
status = true;
}
40. Aphirm.it
Bad Words
var hasBadWords = _affirmationHelper.HasBadWords(affirmation);
if (hasBadWords)
{
TempData["HasBadWords"] = true;
return RedirectToAction("Edit", new {id = affirmation.Id});
}
41. Aphirm.it
Bad Words
if(TempData["HasBadWords"] != null && (bool)
TempData["HasBadWords"])
{
<div class="editor-label error">
Your Aphirmit has some unsavory words. If you would
like to have it published, you will need to clean it up.
</div>
}
43. Thank you
James Johnson
Email: james.johnson@developeradvocates.com
Blog: www.latringo.me
Twitter: latringo
PayPal: members@iedotnetug.org
Slides: www.slideshare.net/latringo/real-world-mvc
Inland Empire .NET User’s Group
2nd Tuesday of each month
www.iedotnetug.org
Editor's Notes
This model helper creates the context if it is null, otherwise it just returns the context
This is how you setup the controller to use the repository. Create instances to the repository and context, then new up the repository with the context
As you can see, using the repository, greatly streamlines your code in how you interact with the entities.
Show code – AphirmitController – 139, Views/Aphirmits/View.cshtml - 74