mirror of https://github.com/abpframework/abp.git
6 changed files with 95 additions and 2 deletions
@ -0,0 +1,24 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.TestApp.Domain; |
|||
|
|||
namespace Volo.Abp.TestApp.EntityFrameworkCore |
|||
{ |
|||
public class PersonRepository : EfCoreRepository<TestAppDbContext, Person, Guid>, IPersonRepository |
|||
{ |
|||
public PersonRepository(IDbContextProvider<TestAppDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async Task<PersonView> GetViewAsync(Guid id) |
|||
{ |
|||
return await DbContext.PersonView.Where(x => x.Id == id).FirstOrDefaultAsync(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Volo.Abp.TestApp.Domain |
|||
{ |
|||
public interface IPersonRepository : IBasicRepository<Person, Guid> |
|||
{ |
|||
Task<PersonView> GetViewAsync(Guid id); |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using Volo.Abp.Timing; |
|||
|
|||
namespace Volo.Abp.TestApp.Domain |
|||
{ |
|||
public class PersonView |
|||
{ |
|||
public Guid Id { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public DateTime CreationTime { get; set; } |
|||
|
|||
public DateTime? Birthday { get; set; } |
|||
|
|||
[DisableDateTimeNormalization] |
|||
public DateTime? LastActive { get; set; } |
|||
} |
|||
} |
|||
Loading…
Reference in new issue