c#,entity-framework,repository-pattern
The repository sits at the bottom of my stack and currently contains my domain models That's your problem, the repository uses domain entities, but it doesn't contain them. The repo is part of the persistence, your domain model should be part of the Domain layer. The repo interface is...
entity-framework,entity-framework-6,repository-pattern
First of all trying to treat your DbContext as singleton object is a bad idea, because you can't manage transactions in your operations. you have to instantiate your DbContext per operation. Second, try to separate your "Data layer concerns" from your "Business concerns". for example : One method for :...
php,oop,symfony2,doctrine,repository-pattern
it's like a basic application service in a typical layered architecture. Application Services : Used by external consumers to talk to your system (think Web Services). If consumers need access to CRUD operations, they would be exposed here. ...
asp.net-mvc,entity-framework-6,repository-pattern,strategy-pattern
Your unit registrations and classes look a little off. From what I can gather, this is what you really want to do. Setup a factory that will determine at runtime which IAuthStrategy should be used: public interface IAuthStrategyFactory { IAuthStrategy GetAuthStrategy(); } public class AuthStrategyFactory { readonly IAuthStrategy _authStrategy; public...
c#,entity-framework,repository-pattern
Its completely OK to use anything for private implementation. It does not exposed to the clients of your repositories via API, so it does not affect them in any way. Actually clients of repositories should depend only on repository abstraction (interface usually). So even public members which are not part...
java,c#,design-patterns,repository-pattern
There is no must . You create as many as the app needs.You could have a repository interface for each business object and a generic interface. Something like interface ICRUDRepo<T> //where T is always a Domain object { T get(GUid id); void Add(T entity); void Save(T entity); } //then it's...
c#,visual-studio-2013,asp.net-mvc-5,repository-pattern
Add a hidden field within BeginForm() for your model.Id @Html.HiddenFor(model=> model.Id) ...
entity-framework,nhibernate,orm,repository-pattern,unit-of-work
Personally i think your approach is solid. But equally Im surprised you see this approach as very different to the repository / Unit of Work Pattern. Your IService layer is directly comparable to a basic Unit of Work layer combined with a repository layer implemented via an interface. The repository...
c#,sql,telerik,repository-pattern,openaccess
I believe you are victim of a subtle difference between definitions of LINQ extension method - in-memory ones use Func<> while SQL-bound use Expression<> as parameter type. My suggestion is to change All(Func<TEntity, bool> x=null) to All(Expression<Func<TEntity, bool>> x=null)
mocking,unity,repository-pattern
This is a very common scenario that lot of developers come across. You using DI. So one of the most important thing is that you should be able to configure your container to resolve a Fake implementation until the real service is ready. As you have mentioned UI dev can...
entity-framework,mongodb,automapper,repository-pattern,nuget-package
You are most probably missing configuration for Author classes. I assume, you also have ME.Book.Author and DE.Book.Author, so you have to provide configure mapping also between these two classes. Extend configuration like this: public static void SetAutoMapperConfiguration() { // fix namespaces and optionally provide mapping between properties Mapper.CreateMap<ME.Book.Author, DE.Book.Author>(); Mapper.CreateMap<ME.Book.Book,...
architecture,repository-pattern,unit-of-work
There is many concepts in your question that don't relate only to the technical part. I've been there trying to solve it technically but this always fails in the long run. What is important is also what a business expert have to say. This is where Domain Driven Design shines...
c#,asp.net-mvc,repository-pattern,html.dropdownlistfor,model-view
@Html.DropDownList("Group", new SelectList(Model.Groups.Select(g => g.GroupName ))) ...
c#,dependency-injection,repository-pattern
Have you registered DbContext with your container? From the error message it looks like the problem is with resolving the dependencies for CountryRepository that is the problem. All dependencies for classes registered in the container must be registered with the container. How can the container create an instance of CountryRepository...
asp.net-mvc,constructor,repository-pattern,unit-of-work,service-layer
Constructors in C# Given your code public TownService() : this(new UnitOfWork()) { //1 } public TownService(IUnitOfWork unitOfWork) { //2 _unitOfWork = unitOfWork; } Invoking new TownService() will Call the parameterless-constructor Instantiate a new UnitOfWork and call the overload TownService(IUnitOfWork unitOfWork), so //2 is executed. This happens because of the this(...)...
design-patterns,repository-pattern
The whole point of programming to an interface is that you should be able to substitute one implementation with another implementation without changing the correctness of the system. This is also known as the Liskov Substitution Principle. Thus, if you were to rename your interfaces based on a concrete implementation,...
java,spring,spring-data,repository-pattern,query-builder
Currently there's no direct support for that. Spring Data JPA already has support to use SpEL expressions in manual query definitions so that e.g. Spring Security specific functions can be used to in JPQL queries. This is shown in this example project but requires manual definition of the queries. We're...
entity-framework,entity-framework-4,repository-pattern,unit-of-work
Yeah, don't use this anti pattern (generic repository wrapping DbContext while exposing EF entities). If you really want to use the Repository make the repository interface return ONLY business (or view models if it's a query repo) objects, never IQueryable or other details exposing EF or whatever are you using....
c#,asp.net-mvc-4,repository-pattern,unit-of-work,business-logic
The short answer - it depends. If it's a fairly complex or sizable application, I like to create a service layer project with the repositories as dependencies. If it's a small application, I'll put the logic in the controller. In my opinion, if it takes more time and effort to...
inheritance,laravel,controller,repository-pattern
If you do like this it will work: The user repository: class UserRepository { public function getProp() { return 'user prop'; } } The Base Controller class BaseController extends Controller { protected $user; protected $prop; public function __construct(UserRepository $user) { $this->user = $user; $this->prop = $this->user->getProp(); } } The FooController...
c#,entity-framework,dependency-injection,repository-pattern
I always go with repository interfaces. First reason is testability - DbContext and DbSet<T> are hard to mock. So, unit-testing of services becomes really hard, if even possible. Second reason is IQueryable<T> being exposed by EF. It makes data-access logic spread over whole application, which violates SRP and makes fixing...
azure,visual-studio-2013,asp.net-mvc-5,repository-pattern,web-deployment
Turns out something was wrong with my repository pattern and unit of work i redid the patterns again from scratch and it works
c#,asp.net-mvc,repository-pattern
DeleteRepository contains the Read method, as it inherits from ReadRepository. The issue is you're local variable is of type IDeleteRepository<Course> - this is no Read method on IDeleteRepository<Course>. If you changed your declaration to the correct type, you would have access to both methods: DeleteRepository<Course> deleteRepository = new DeleteRepository<Course>(new DbContext("SchoolDemoEntities"));...
asp.net,asp.net-mvc-5,ninject,entity-framework-6,repository-pattern
It might be difficult to test your bll if if you can't mock the objects within the dal, so using interfaces and di would be useful in my opinion. You also have the option of swapping out your dal for a different dal if you loosely couple it. The interfaces...
php,doctrine2,zend-framework2,repository-pattern
There are several ways to do this, of course. The typical way you'd do this kind of thing in a ZF2/D2 project would be to start with DoctrineORMModule. That module exposes Doctrine's EntityManager via the ZF2 Service Manager in a variety of handy ways (you can $sm->get('doctrine.entitymanager.orm_default') to explicitly get...
asp.net-mvc,entity-framework-6,repository-pattern,asp.net-mvc-viewmodel
So I solved this by ensuring that the primary key field PersonID is included in the View. I didn't think I needed it originally because it started off as a read-only Details view, and PersonID wasn't needed to be displayed. But when posting data back, I needed to add it...
you could use Generics to make it strongly typed based on your situation. Ex., namespace Test.Database { public interface IEntity<T> { T KeyValue { get; set; } } } ...
c#,asp.net,asp.net-mvc,entity-framework,repository-pattern
This is what I would do: Implement a repository for each entity in the context. If you have a set of similar operations that are done to all entities (for example, GetAll, GetByID, Create, Update, Delete), you could define a common interface which will be your starting point. Then, all...
c#,asp.net-mvc,linq,entity-framework-6,repository-pattern
You only need to add a condition to filter the users that belong to the group 4. Try this: _listedUsersByGroupID = (from _user in _uow.User_Repository.GetAll() .Include(s=>s.UserInGroup.Select(r=>r.Group)) where user.UserInGroup.Any(ug=>ug.groupID==4) select _user).ToList(); ...
entity-framework,architecture,automapper,repository-pattern
So the answer is simple. Bit of a silly question to begin with. The declaration for IRep was wrong. BaseRep<T,U>:IRep<T> instead of IRep<T, U>. The rep interface should be: public interface IRepository<T> where T : class { void Insert(T model); IEnumerable<T> GetAll(); } The base repository should be: public class...
xamarin,repository-pattern,sqlite-net
This is an old question but here is my implementation. I´m using async connections as they provide better performance in mobile projects. The nuggets I installed are Sqlite.Net-PCL and Sqlite.Net.Platform.XamarinAndroid on the Android project (there´s another one for ios), and SQLite.Net.Async-PCL on the Core project. My Repository looks like this:...
domain-driven-design,repository-pattern,dao
You are actually asking quite a number of questions here so I'll try to keep the answers as terse as possible :) Repositories return an Aggregate Root or an Entity. Some are quite adamant that repositories only return ARs and that is fine and will always suffice. There are two...
c#,asp.net-mvc,entity-framework,repository-pattern
You should be injecting your ObjectContext into your repository instances, this way you can inject the same instance into both repositories and avoid the error. If you are using an IoC container it should allow you to specify the scope of instances it creates. If you are using Autofac, you...
c#,asp.net-mvc,entity-framework,repository-pattern,nopcommerce
To provide a code example of why Approach 1 is better consider a test scenario. With Approach 2, when you call the Insert method in a unit test you will actually be calling: Controller.Insert > MyBal.Insert > Database execution. This is not what we want in unit testing. In unit...
mobile,asp.net-web-api,breeze,repository-pattern,unit-of-work
1) No you cant use breeze contextProvider.SaveChanges() in your other controllers. contextProvider.SaveChanges(JObject saveBundle) breeze server side expects saveBundle to be a json data created by breeze client side js. 2) Create any other webapi controller for REST with its own repository. You can't work with breeze's repository saveChanges without breeze...
c#,repository-pattern,unit-of-work
I wouldn't write the cancelling logic twice. Where you have it is up to you, but given your current structure, I'd inject ICustomerService into BatchService. So class could look something like public class BatchService : IBatchService { public ICustomerService<Customer> CustService { get; set; } public void CancelOrders(params int[] orderNos) {...
asp.net-mvc,repository-pattern
This is an example of an Abstract Factory design pattern. The idea is to create a seam to provide loose coupling between the classes so another type of context could be swapped, either for testing purposes or to extend the application. Generally speaking, a factory is a way to manage...
unit-testing,mocking,moq,repository-pattern
Reproducing the solution the asker found themselves. The problem occurs when you use one of the overloads of Returns which takes in a Func delegate. That Func must either take zero parameters (i.e. a Func<TResult> where TResult is known at compile-time to be IQueryable<DomainObject> in your case) or take the...
java,design,domain-driven-design,repository-pattern
Repositories should return domain objects, more precisely Entities (the DDD sort), and more precisely Aggregate Roots, most of the time, because their consumers need to ask aggregates to do things. One popular way to keep the Domain isolated from infrastructure and persistence concerns is to declare Repository interfaces in it,...
entity-framework,dependency-injection,repository-pattern,autofac,unit-of-work
Your on the right track, I have used var mtc = new MultitenantContainer(container.Resolve<ITenantIdentificationStrategy>(), container); DependencyResolver.SetResolver(new AutofacDependencyResolver(mtc)); The identification strategy would be based on the logged in user. With defaults for when they aren't logged in. public class CompanyNameIdentificationStrategy : ITenantIdentificationStrategy { public bool TryIdentifyTenant(out object tenantId) { var context =...
c#,entity-framework,dependency-injection,domain-driven-design,repository-pattern
"Depository" lol.... Anyways, you got right the bit that you don't want the domain coupled to EF that's why the T in your repository interface should be domain aggregate root and NOT an EF entity (or a 'domain' object designed to work properly with EF). Your Domain layer is never...
laravel,service,laravel-5,repository-pattern
When you access class variables, you need to do $this->some_var, not $this->$some_var. In the latter case, PHP thinks you're trying to use the string value of $some_var, and it can't - so that's why it's complaining about not being able to convert to string. Just changing that should work right...
c#,linq,entity-framework,repository-pattern
I would argue that you are worried about restricting operations at the wrong layer; the Repository. Assuming your Repositories are supposed to abstract away the details of your DB and Entity Framework, I think this is too low of a level to do what you want. If you have a...
c#,asp.net-mvc,repository-pattern,asp.net-mvc-viewmodel
I would have done it a little different. You want to return a single view model to the view consisting of a list of users and a list of groups (please correct me if I am wrong). I would have initialised the lists to empty (containing no items) in the...
asp.net,asp.net-mvc,dependency-injection,repository-pattern
The answer is: it depends. If your application is small, with two entities in a single database, and you do minimal transformation or validation work on save, I would say you should only have one repository class for access to both entities. This minimizes complexity. However if you need to...
asp.net-mvc,repository-pattern,poco
Usually, the Repository is the method of accessing the data and is therefore just an implementation technique of the DAL. I'd combine them both as the DAL. In terms of other models, I assume you mean the classes that correspond with your data items. These should also live in...
c#,entity-framework,entity-framework-6,repository-pattern
You have to understand that two processes are going on: Entity Framework keeps track of the entities that are loaded in DbContext, maintaining their state as Added, Modified, Deleted or Unchanged. You can check this with a MyDataContext.Entry(MyEntity).Statecall. Outwardly the POCO classes behave just like you would expect from classes...
asp.net-mvc,dependency-injection,repository-pattern,autofac,unit-of-work
Without looking at the view it is hard to say where your delay is. There are several things to consider: DI consume virtually no time here, so do not blame it When using ORMs, always pair it with a profiler like EF Profiler from Hibernating Rhinos or DevArt. See SQL...
asp.net-mvc,domain-driven-design,repository-pattern,n-tier-architecture,ddd-repositories
This is probably best suited for CodeReview, but here are a few thoughts that may save you some trouble : Having a whole separate DAL object model might be overkill. Most modern ORMs will take care of the domain objects/DB mapping for you without polluting your domain model with persistence...
asp.net-mvc-5,entity-framework-6,repository-pattern
Ideally you want to separate your actual business logic from your entities and abstract it away from your database or ORM as much as possible by creating a business logic layer and injecting your repository into your service/business logic layer using an IoC container and dependency injection. The common approach...
c#,asp.net-mvc,entity-framework,asp.net-mvc-4,repository-pattern
Make customer list a child of user: then you can pull / map the list within your customer service. Start by adding CustomerList to you user ViewModel: public class UserModel : IUserModel { private ICustomerService _customerService; public UserModel() : this(new CustomerService()) { } public UserModel(ICustomerService customerService) { _customerService = customerService;...
oop,design-patterns,repository,repository-pattern
Repository can be viewed as a special kind of Façade (structural) but also as a special kind of Factory (creational). Also, as the Repository often expose collection-like interface, then it might be a special application of Iterator (behavioral). What I am trying to say is that neither those categories nor...
c#,csv,generics,repository-pattern
Try following - repository.InsertAllOnSubmit(list.Take(100).Cast<Activity>()); Cast extension method lets you cast enumerables from one type to another (Assuming of course that the cast is valid.. which is what you expect with explicit casts)....
asp.net-mvc,design-patterns,ado.net,repository-pattern,unit-of-work
I've written a blog post which teaches you on how to write driver independent code and how to implement Uow/Repository pattern with plain ADO.NET. It's a bit too long to include in this answer, but basically the IDbtransaction will represent your Unit oF Work (or be contained in one) and...
php,laravel,eloquent,repository-pattern,service-layer
You have two classes with the same name in the same namespace. Use different namespaces so you can use the same class names. I usually use \Models to locate my models classes. At the top of each model file: namespace Models; In your controller or any part of your app:...
json,entity-framework,repository-pattern,asp.net-web-api2,poco
The performance has been improved by Enabling Lazy Loading.
The return type of the implementation of the interface must match the return type declared in the interface. This is called return type covariance and it is not supported by C#. So the code below doesn't work even though List implements IList public interface IFoo { IList<string> Foos {get; set;}...
c#,unit-testing,design-patterns,repository-pattern
+1 on zaitsman's comment. You seem to already have a nice seam in place that allows testing MyRepository in isolation. If a) IDataAccess is an interface and b) your GetClientsForTenant method uses it internally, you can provide a fake IDataAccess that returns precooked fakeClients and you will be able to...
c#,asp.net-mvc,asp.net-mvc-4,repository-pattern,unit-of-work
We saw together you should separate your service from your repository. Here, your problem seems to come from the fact you use two different dbcontext instances. one in your repository and one in your UnitOfWork. Instead, you should inject the same Dbcontext instance in your repository and your UnitOfWork. EDIT:...
c#,asp.net-mvc-5,entity-framework-6,asp.net-identity,repository-pattern
Ok, I figured this out. The reason why there's no Update in new repository patterns (Entity Framework 6) is because there's no need for one. You simply call your record up by id, make your changes and then commit/save. For example, this is my edit POST method from my postController:...
c#,repository-pattern,business-logic,bll
The repository patterns responsibility is to store and fetch data from the data layer and to make abstraction about how this data layer looks like. The idea behind it is that if this underlying layer should change, you would possibly need to change the implementation of the repository but not...
domain-driven-design,repository-pattern,ddd-repositories
I've been developing using DDD techniques for around 6 months now and always use the save and delete methods, the save should persist the data to your persistence layer, the delete should remove from your persistence layer. Saying the above, there is no reason why it shouldnt add to your...
c#,entity-framework,repository-pattern
Yes there is a better approach. For a new person, use: _context.People.Add(myPerson); //myPerson can have Pets attached This will traverse all sub objects and mark them as NEW. When updating person, after calling the above code, you need to set which pet objects are modified/deleted. I learned this in a...
c#,asp.net-mvc-4,repository-pattern,unit-of-work,onion-architecture
Managing transactions in the repository is definitely not the standard way to do it, as it removes the possibility to implement business logic that spans multiple repositories (or multiple actions on the same repository) and is required to be executed atomically. I would try to keep the transaction management on...
c#,asp.net-mvc,architecture,repository-pattern,service-layer
In general repository should encapsulate only the logic of accessing database (initialization of context, transactions, connections and etc.). It is very common to create a generic CRUD repository and reuse it for all your business entities. All the business related logic should be placed in business layer(service layer). The major...
c#,.net,entity-framework,repository-pattern
So here is my question. Where does the logic for loading file data into EF entities belong? My opinion is that it belongs in your repositories. Your data-stores aren't always going to be databases. They can be files, internal and external services, excel sheets, etc. Should I make this...
laravel,eloquent,repository-pattern,service-layer
The easy way: public function assignToAuthor($postId, $authorId) { $post = $this->find($postId); // or whatever method you use to find by id $post->author_id = $authorId; } Now, the above implies that you know the foreign key author_id of the relation. In order to abstract it just a bit, use this: public...
c#,entity-framework,inheritance,repository-pattern,unit-of-work
unitOfWork.FieldRepository has type IFieldRepository so only GetAllFields() is visible: IFieldRepository repository = unitOfWork.FieldRepository; repository.GetAllFields(); You need either cast it to EFGenericRepository<Field>, IFieldRepository (don't do it!) or add this method to the interface: public interface IFieldRepository { void Insert(Field entity); } Being virtual doesn't make any difference here, you can remove...
architecture,exception-handling,repository-pattern
I honestly think that it isn't addressed because of the ongoing (and emotional) debate about what to do with exceptions. There is a constant back and forth over whether exceptions should be handled locally (where there is a greater chance of understanding them and doing something intelligent, like retrying) or...
c#,design-patterns,repository-pattern
Generally, your logic that makes decisions based on business rules goes in the service layer. The code that creates, updates, or deletes rows from tables (the standard CRUD functions) goes into the repository. So if you need to retrieve data by joining multiple tables together, that's in the repository. The...
c#,asp.net-mvc,design-patterns,repository-pattern
If you're using a code first approach, Entity Framework will automatically pluralize your entity names when generating the tables, so lets add some context to your question first and remove all that abstraction, lets say we're creating a User repository, entity frameworks will automatically generate a Users table. public partial...
c#,.net,entity-framework,repository-pattern,n-tier-architecture
Per this question: Cannot insert the value NULL into column in ASP.NET MVC Entity Framework The answer came down to adding [DatabaseGenerated(DatabaseGeneratedOption.None)] to my Entity runs like a charm. Huge shout out to @JeffTreuting for pointing me in the right direction with the SQL Trace. I honestly hadn't even thought...
c#,repository,repository-pattern,structuremap
The Find method does not expect a generic type and the where clause is returning an IEnumerable which you're attempting to cast as Employee. Replace the where clause with FirstOrDefault. e.g. _employeeRepository.Find() .FirstOrDefault(i => i.User_Name == employee.User_Name) ...
orm,domain-driven-design,repository-pattern
I have been thinking for some time that if one were to remove the change-tracking from an ORM then developers would see far less value in them. Lazy-loading should never happen. An aggregate is always loaded in its entirety. If you find yourself requiring lazy-loading chances are that you are...
c#,nhibernate,domain-driven-design,repository-pattern
I think the key here is that you want to change the thought process to entity to entity or value object relationships. In the way you are modeling your classes, you have a UserId as a property and are talking about it as if it was a relationship. I think...
c#,entity-framework,repository-pattern,asp.net-identity,unit-of-work
Found some sort of solution, which looks generic enough, but I'm still not sure if it's really good and doesn't break Repository/UnitOfWork pattern principles. I added generic GetDbContext() method to my IUnitOfWork: public interface IUnitOfWork : IDisposable { void Save(); IRepository<TEntity> GetRepository<TEntity>() where TEntity : class; TContext GetDbContext<TContext>() where TContext...
c#,repository-pattern,simple-injector
First of all, you will have a serious problem here, because to do this, you will have to know the password of each user, or make it plain somehow. I'm not sure if it can be done. If it can, the code below will give you a good starting point....
c#,repository-pattern,solid-principles
Repository should have single responsibility - persist one kind of entity. E.g. employees. If you have to delete some associated records from other repository, it looks like business logic. E.g. When employee is fired we should remove his work log And usual place for business logic is a domain services....
entity-framework,repository-pattern,unit-of-work
any .Include() calls should be added after the query is constructed, otherwise they are ignored. You should write public IQueryable<T> SearchFor(Expression<Func<T, bool>> predicate, string includePath = null) { var query = DbSet.Where(predicate); if (!string.IsNullOrEmpty(includePath)) { query = query.Include(includePath); } return query; } Your problem is also that you did DbSet.Include(includePath)...
asp.net-mvc,entity-framework,ef-code-first,repository-pattern
But [with ICollection] I can add new order in Controller without using service or repository. You mean you can do this (assuming there's a viewmodel for adding an order to a user and a SaveChanges() somewhere): public class UserController { public ActionResult AddUserOrder(AddUserOrderModel addOrder) { User user = User.GetByEmail(addOrder.UserEmail);...
c#,domain-driven-design,repository-pattern
You can use PropertyInfo (Like the following): foreach (PropertyInfo propInfo in theType.GetProperties()) { for (int i = 0; i < reader.FieldCount; i++) { if (reader.GetName(i).Trim().ToLower() == propInfo.Name.Trim().ToLower()) { object asObj = reader.GetValue(i); if (asObj is System.DBNull) propInfo.SetValue(thisRow, null, null); else propInfo.SetValue(thisRow, reader.GetValue(i), null); } } } The type would be...
entity-framework,asp.net-mvc-5,repository-pattern,code-first
I could not find a suitable solution to my problem. After more searching i ended with 3 solutions: Create extension methods. Create a custom IDbSet which can accept a filter expression. Add a discriminator to every model. I choosed solution(3) although, I don't like it much...
php,mysql,repository-pattern,laravel-5
(Sometimes, I believe the "Answer" to a question involves "lowering expectations".) I believe you are asking too much for a "Repository Pattern". There are many 3rd party software packages that attempt to isolate the user from MySQL. They generally have limitations. Often a limitation is in scaling -- they are...
c#,entity-framework,repository-pattern
There are two major options: Treat situations like NotFound as exceptional. Specify exception types that will be thrown by your repository in situations where the object you meant to delete wasn't there. If you choose this option, then you can have a very general exception-catching handler at the Web API...
c#,transactions,repository-pattern,service-layer
You need to make both methods share the same database connection and transaction. How you do that is your choice. Your code looks like an anti-pattern. You're supposed to use one ObjectContext per unit-of-work where the UOW scope should encompass everything you need to do. Often, the scope is an...
laravel,repository-pattern,laravel-5,solid-principles
What you get from User::all() or basically every Eloquent query is a Illuminate\Database\Eloquent\Collection. The problem is that when you call toArray() on the collection it will convert all the items of the collection into an array too and you loose all the methods of your model. Instead you can call...
c#,asp.net-mvc,entity-framework,asp.net-mvc-4,repository-pattern
Include is made to eagerly load navigation properties, meaning any property that is, in fact, another related entity. Since Nombre is a string, you do not need to include it: it is part of the entity that is returned from the database call. If Nombre were of a class representing...
c#,asp.net-mvc,repository-pattern,unit-of-work
I think I understand this better after some time, so figured I would close it. I didn't need to "override" anything, I just needed to add the additional work in my unit of work class (duh), and then call the insert. Thanks for the thought provoking responses.
javascript,node.js,promise,repository-pattern,q
I have a feeling that the way I use promises is not correct Yes, you use the deferred antipattern a lot. Promises do chain, which means that you simply can return values and even promises from your then callback, and the .then() call will yield a promise for those...
c#,entity-framework,entity-framework-6,repository-pattern,repository-design
Honestly, I would not bother abstracting Entity Framework behind a repository unless you have a very good reason. You will create more work, make it harder on you in the future, and I believe EF is already a good enough abstraction from the persistence logic. That being said, if you...