Skip to content

Instantly share code, notes, and snippets.

View stevenh77's full-sized avatar

Steven Hollidge stevenh77

View GitHub Profile
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="WcfJsonRestService.Service1" behaviorConfiguration="MyServiceBehavior">
<endpoint address="" binding="webHttpBinding" contract="WcfJsonRestService.IService1"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/service1" />
</baseAddresses>
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="WcfJsonRestService.Service1" behaviorConfiguration="MyServiceBehavior">
<endpoint address="" binding="webHttpBinding" contract="WcfJsonRestService.IService1"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/service1" />
</baseAddresses>
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="WcfJsonRestService.Service1" behaviorConfiguration="MyServiceBehavior">
<endpoint address="" binding="webHttpBinding" contract="WcfJsonRestService.IService1"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/service1" />
</baseAddresses>
public class AccountRepository : DataRepositoryBase<Account>, IAccountRepository
{
protected override Account AddEntity(CarRentalContext entityContext, Account entity)
{
return entityContext.AccountSet.Add(entity);
}
protected override Account UpdateEntity(CarRentalContext entityContext, Account entity)
{
return (from e in entityContext.AccountSet
public abstract class DataRepositoryBase<T> : DataRepositoryBase<T, CarRentalContext>
where T : class, IIdentifiableEntity, new()
{
}
public abstract class DataRepositoryBase<T, U> : IDataRepository<T>
where T : class, IIdentifiableEntity, new()
where U : DbContext, new()
{
protected abstract T AddEntity(U entityContext, T entity);
protected abstract T UpdateEntity(U entityContext, T entity);
protected abstract IEnumerable<T> GetEntities(U entityContext);
public interface IDataRepository
{
}
public interface IDataRepository<T> : IDataRepository
where T : class, IIdentifiableEntity, new()
{
T Add(T entity);
public interface IIdentifiableEntity
{
int EntityId { get; set; }
}
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using CarRental.Business.Bootstrapper;
using CarRental.Business.Entities;
using CarRental.Data.Contracts;
using Core.Common.Contracts;
using Core.Common.Core;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
-webkit-box-sizing: border-box;