Skip to content

Instantly share code, notes, and snippets.

View stevenh77's full-sized avatar

Steven Hollidge stevenh77

View GitHub Profile
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 abstract class DataRepositoryBase<T> : DataRepositoryBase<T, CarRentalContext>
where T : class, IIdentifiableEntity, new()
{
}
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
<?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>