Size: a a a

2021 November 02

МЕ

Макс Епифанов... in CODE BLOG / C#
да я в курсе)
источник

P

Phantom in CODE BLOG / C#
Слит
источник

EA

Egene Avdeev in CODE BLOG / C#
А вы куда то до F# тянетесь
источник

И

Иhor in CODE BLOG / C#
Определился когда скинул тебе вот это, умняш:

The single best reason to not use the repository pattern with Entity Framework? Entity Framework already implements a repository pattern. DbContext is your UoW (Unit of Work) and each DbSet is the repository. Implementing another layer on top of this is not only redundant, but makes maintenance harder.

People follow patterns without realizing the purpose of the pattern. In the case of the repository pattern, the purpose is to abstract away the low-level database querying logic. In the old days of actually writing SQL statements in your code, the repository pattern was a way to move that SQL out of individual methods scattered throughout your code base and localize it in one place. Having an ORM like Entity Framework, NHibernate, etc. is a replacement for this code abstraction, and as such, negates the need for the pattern.

However, it's not a bad idea to create an abstraction on top of your ORM, just not anything as complex as UoW/repostitory. I'd go with a service pattern, where you construct an API that your application can use without knowing or caring whether the data is coming from Entity Framework, NHibernate, or a Web API. This is much simpler, as you merely add methods to your service class to return the data your application needs. If you were writing a To-do app, for example, you might have a service call to return items that are due this week and have not been completed yet. All your app knows is that if it wants this information, it calls that method. Inside that method and in your service in general, you interact with Entity Framework or whatever else you're using. Then, if you later decide to switch ORMs or pull the info from a Web API, you only have to change the service and the rest of your code goes along happily, none the wiser.

It may sound like that's a potential argument for using the repository pattern, but the key difference here is that a service is a thinner layer and is geared towards returning fully-baked data, rather than something that you continue to query into, like with a repository.
источник

Б[

Барсик [SpamBlock]... in CODE BLOG / C#
А чтоб говорить что язык не говно, на нем писать не обязательно?
источник

И

Иhor in CODE BLOG / C#
Читай пожалуйста внимательно
источник

Б[

Барсик [SpamBlock]... in CODE BLOG / C#
Слит х2
источник

RO

Roman Onofreichuk in CODE BLOG / C#
https://docs.microsoft.com/en-us/ef/core/querying/related-data/lazy

А еще за антипаттерны говоришь
источник

P

Phantom in CODE BLOG / C#
Нет
источник

Б[

Барсик [SpamBlock]... in CODE BLOG / C#
Вывод, фантом обосрался
источник

P

Phantom in CODE BLOG / C#
Не говно != очень хорош
источник

Б[

Барсик [SpamBlock]... in CODE BLOG / C#
Как и обычно
источник

Б[

Барсик [SpamBlock]... in CODE BLOG / C#
источник

И

Иhor in CODE BLOG / C#
Никто тебя не заставляет использовать лейзи
источник

P

Phantom in CODE BLOG / C#
Ты стрелку то не поворачивай
источник

F

FFx in CODE BLOG / C#
И на том спасибо.
источник

МЕ

Макс Епифанов... in CODE BLOG / C#
видел мою преднастройку лези?
источник

P

Phantom in CODE BLOG / C#
Ты сам не делая делаешь громкие заявления, что он говно
источник

И

Иhor in CODE BLOG / C#
Та ладно, фшарп нормальный язык
источник

F

FFx in CODE BLOG / C#
Хотя F# - круто.
источник