Entity Framework
The Entity Framework helps developers to work with real data
in the form of objects and properties without the underlying database tables
and columns where the data is stored. With entity framework, developers
can work at a higher level of abstraction when they deal with data and can
create/maintain data-oriented applications with less code than in traditional
applications. As Entity Framework is a component of the .NET Framework, Entity
Framework applications can run on any computer with the .NET Framework starting
with version 3.5 SP1 installed.
Linq
Linq is easier to transform data into objects. LINQ reduces
the amount of work one must do to translate between object-oriented code and
data paradigms such as hierarchical, flat-file, messages, relational, and
more. It doesn't eliminate the "Impedance Mismatch" because one
must still be reasonable about the data in its native form, and the bridge from
here to there is (IMO) much shorter. Linq also helps to reduce SQL injection
attacks.
.
Repository Pattern
Repository pattern
helps to get more control over data. For example strongly typed business
entities helps to identify problems at compile time itself. This pattern helps
for a centrally managed, consistent access rules and logic. Other benefit is
when using repository pattern you don't need to know any knowledge about the
data source or data layer. Repository
pattern is a layer between DAL (Data Access Layer) and the business Logic
layer.

Implementations
Create objects User Info and Clients to manage the data
public class UserInfo
{
public string UserName { get;
set; }
public string Password { get;
set; }
}
public class Clients
{
public
int ClientID { get;
set; }
public
int UserID { get;
set; }
public
string clientName { get;
set; }
public
bool mobileVersion { get;
set; }
public
bool tabletVersion { get;
set; }
}
Create Generic interface for the repository class to handle any
Objects
using
System.Collections.Generic;
using
mvc_model.Models.Objects;
namespace mvc_model.Models
{
//used this
method so we can use any object with this interface
interface UserInterFace<T> where
T:class
Join the conversation! Your thoughts help the community grow.