51

Re: Code First + SQL Triggers

Well and be finite all should Async:-Q

52

Re: Code First + SQL Triggers

Calabonga wrote:

In other words, it BLL should be implemented separately from a DB through any abstraction layer, for example through pattern Repository. So?

Yes, all is true.

53

Re: Code First + SQL Triggers

skyANA wrote:

Well and is finite all should Async:-Q

ja, ja, das ist fantastisch!:-Q

54

Re: Code First + SQL Triggers

skyANA;
It is inclined  with you because with such implementation successfully consults itself DbContext, it it  "from a box". In this situation yours Repository a superfluous intermediate link. Therefore, I prefer something to add in repository implementation that it was more useful. For example, Mapping or Pagination. Even made pair of packets Calabonga. EntityFramework and Calabonga. EntityFrameworkCore moreover, described it in another to article .
On the other hand, how many people, are so much and judgements. It is rather grateful to you that paid the precious attention. Thanks.

55

Re: Code First + SQL Triggers

skyANA;

wrote:

I to you would advise to esteem about Domain Driven Design. I think that it will be interesting to you.
https://www.amazon.com/Implementing-Dom … 0321834577

Thanks, I is mandatory esteem. Can that new I will find. smile

56

Re: Code First + SQL Triggers

skyANA wrote:

the Example:

public class Post: EntityBase
{
public string Author {get; set;}
public string Title {get; set;}
public string Content {get; set;}
public string [] Tags {get; set;}
public DateTime CreatedAtUtc {get; set;}
public List <Comment> Comments {get; set;}
}
public class Repository <T>: IRepository <T> where T: EntityBase
{
private readonly ApplicationDbContext dbContext;
public Repository (ApplicationDbContext dbContext)
{
this.dbContext = dbContext;
}
public virtual T GetById (int id)
{
return dbContext. Set <T> ().Find (id);
}
public virtual IEnumerable <T> List ()
{
return dbContext. Set <T> ().AsEnumerable ();
}
public virtual IEnumerable <T> List (System.Linq.Expressions.Expression<Func<T, bool>> predicate)
{
return dbContext. Set <T> ().Where (predicate).AsEnumerable ();
}
public void Insert (T entity)
{
dbContext. Set <T> ().Add (entity);
dbContext. SaveChanges ();
}
public void Update (T entity)
{
dbContext. Entry (entity).State = EntityState. Modified;
dbContext. SaveChanges ();
}
public void Delete (T entity)
{
dbContext. Set <T> ().Remove (entity);
dbContext. SaveChanges ();
}
}

It is a normal repository.
The essence in that that can be rewritten for another ApplicationDbContext.

57

Re: Code First + SQL Triggers

Calabonga wrote:

skyANA;
It is inclined  with you because with such implementation successfully consults itself DbContext, it it  "from a box". In this situation yours Repository a superfluous intermediate link. Therefore, I prefer something to add in repository implementation that it was more useful. For example, Mapping or Pagination. Even made pair of packets Calabonga. EntityFramework and Calabonga. EntityFrameworkCore moreover, described it in another to article .
On the other hand, how many people, are so much and judgements. It is rather grateful to you that paid the precious attention. Thanks.

Essence of a repository that it hides behind itself(himself) storage.
That is it can be and a SQL Server, both MongoDB, and Couchbase, and indirect service, and generally a little  is serial, or is parallel.
At you it quits not a repository, and a wrapper over EF.

58

Re: Code First + SQL Triggers

Calabonga wrote:

it it  "from a box".

+1

Calabonga wrote:

Therefore, I prefer something to add in repository implementation that it was more useful. For example, Mapping or Pagination

well  and it is in NuGet small .

59

Re: Code First + SQL Triggers

ViPRos wrote:

It is a normal repository.
The essence in that that can be rewritten for another ApplicationDbContext.

you with EF did not work, therefore all rewrite.

60

Re: Code First + SQL Triggers

skyANA wrote:

it is passed...
Essence of a repository that it hides behind itself(himself) storage.
That is it can be and a SQL Server, both MongoDB, and Couchbase, and indirect service, and generally a little  is serial, or is parallel.
At you it quits not a repository, and a wrapper over EF.

Well also what?
As soon as it will be necessary to envelop that that another he writes other implementation

61

Re: Code First + SQL Triggers

Petro123 wrote:

it is passed...
You with EF did not work, therefore all rewrite.

When you will learn? Such impression that any small barrier you can not overcome
As soon as you will skip at once shifted to the Left there will be another

62

Re: Code First + SQL Triggers

Calabonga;
And my example was about that TagRepository and Provider have no sense.
It is quite possible to be restricted PostRepository: Repository <Post> , or generally DbContext but then there is a rigid dependence from EF.
Post is a root of aggregation, essence (Entity).
And at its saving EF displays it on all necessary tables, on that EF and ORM:-Q

63

Re: Code First + SQL Triggers

ViPRos;
You helloWorld wrote a site?
And  for councils?

64

Re: Code First + SQL Triggers

ViPRos wrote:

it is passed...
Well also what?
As soon as it will be necessary to envelop that that another he writes other implementation

He wrote: "In this situation yours Repository a superfluous intermediate link".
Allow to ask, if it throws out this link he writes other implementation of that, DbContext that-whether?

65

Re: Code First + SQL Triggers

skyANA;
It seemed to me that you told that it is an example of a "wrong" repository.

66

Re: Code First + SQL Triggers

skyANA wrote:

the Essence of a repository that it hides behind itself(himself) storage.

I would tell more, it hides behind itself(himself) storage, and data storage singularities in the given storage which disappear a data access layer.

67

Re: Code First + SQL Triggers

skyANA wrote:

it is passed...
Repository - as abstraction on access to a DB (DAL). Its task to get rid of a specific DB. That is to your repository it should be absolute , to what database to cling (MS SQL, PostgreSQL, SqlLite, Oracle, InMemory, etc). Thus, EntityFramework does too most only on the basis of dial-up Provider'. For this reason I also say that your implementation simply doubles a functional which already does EntityFramework. And I consider that in it there is not enough sense. Therefore I in the repository introduced a bit more duties, as that: Mapping, Pagination and Secutiry (in particular, Row Level Security).
And, as a matter of fact, it is possible to tell that my implementation is "the Superstructure on EntityFramework" for simply Repository already in EntityFramework is implemented.
P.S.: by the way, at usage of the DI-container pattern Unit Of Work too is not meaningful owing to that the container implements its functional on 100 %. But you can introduce the vision in this pattern, and you will have a wrapper. smile

68

Re: Code First + SQL Triggers

hVostt wrote:

it is passed...
I would tell more, it hides behind itself(himself) storage, and data storage singularities in the given storage which disappear a data access layer.

More likely such template simply is not present, it is a special case .

69

Re: Code First + SQL Triggers

And the general rule appears in a type "turn all what not your or your, but can change".

70

Re: Code First + SQL Triggers

ViPRos wrote:

is faster than such template simply is not present, it is a special case .

At all is not present. Simply when from a repository want: a filtration, paging, search,  in the data... Then the abstraction starts to float and are born ugly year . Are necessary or specifications, or   then all will be a way. It is not necessary to return from a repository IQueryable.

71

Re: Code First + SQL Triggers

ViPRos wrote:

And the general rule appears in a type "turn all what not your or your, but can change".

No, it how to tell, looking at operation , cut, cut all that gets under a hand smile))

72

Re: Code First + SQL Triggers

hVostt;
It is necessary to return generally either explicitly, or system

73

Re: Code First + SQL Triggers

hVostt;
But any reptile cannot tell that wrote not on patterns smile

74

Re: Code First + SQL Triggers

IQuerable it is possible to return is part NET

75

Re: Code First + SQL Triggers

Calabonga wrote:

Therefore I in the repository introduced a bit more duties, as that: Mapping, Pagination and Secutiry (in particular, Row Level Security).

And where it? Yours? The documentation? Examples?
We that about the trigger, about  that about a pattern.

Posts [ 51 to 75 of 83 ]

Pages Previous 1 2 3 4 Next

You must login or register to post a reply