urfnet / urf.net Goto Github PK
View Code? Open in Web Editor NEWUnit of Work & Repositories Framework - .NET 4.x
Home Page: http://blog.longle.io
License: MIT License
Unit of Work & Repositories Framework - .NET 4.x
Home Page: http://blog.longle.io
License: MIT License
Original content is here. Do not include information that doesn't apply to the codeplex repository and/is no longer relevant.
there is any other sample more than https://github.com/urfnet/URF.NET/tree/master/main/Sample/Northwind.Web?
Currently UnitOfWork.RepsitoryAsync creates a new instance regardless if IUnityContainer has been configured and DI/IoC is registered, in the case that it is, we want to return the instance from the container and not new one up.
Hi,
Thanks for the great project.
I was looking for the github url of "URF .NET Core", but could not find it, so can you please provide it.
also, i noticed that:
https://www.nuget.org/packages/URF.Core/1.0.0
is unlisted.
My service class wants to be static and I'm not sure what I'm doing wrong. The service class causes the compiler error:
Error CS1106 Extension method must be defined in a non-generic static class Northwind.Service D:\src\samples\URF.NET-master\URF.NET-master\main\Sample\Northwind.Service\DynamicMenuService.cs 11 Active
Repository Class
`using Northwind.Entities.Models;
using Repository.Pattern.Repositories;
using System.Collections.Generic;
using System.Linq;
namespace Northwind.Repository.Repositories
{
public static class DynamicMenuRepository
{
public static IEnumerable DynamicMenusByCategoryAndType(
this IRepositoryAsync repository, MenuCategory menuCategory, MenuType menuType)
{
return repository
.Queryable()
.Where(x => x.TypeId == menuType && x.MenuCategoryId == menuCategory)
.OrderBy(x => x.SortOrder)
.AsEnumerable();
}
}
}`
Service Class
`using System.Collections.Generic;
using Northwind.Entities.Models;
using Northwind.Repository.Models;
using Northwind.Repository.Repositories;
using Repository.Pattern.Repositories;
using Service.Pattern;
namespace Northwind.Service
{
public class DynamicMenuService : Service, IDynamicMenuService
{
private readonly IRepositoryAsync _repository;
public DynamicMenuService(IRepositoryAsync repository) : base(repository)
{
_repository = repository;
}
public IEnumerable<DynamicMenu> MenuByType(this IRepositoryAsync<DynamicMenu> repository
, MenuCategory menuCategory, MenuType menuType)
{
return _repository.DynamicMenusByCategoryAndType(menuCategory, menuType);
}
}
}`
hi mr lelong37,
Are you missing TrackableEntities.Common packages when get package from NuGet, when I got source code to build dll, I saw you use ITrackable instead of. If I get URF via Nuget, issues when run because URF missing dependency library. You can check again if I think wrong.
Thank you
How to add tenantId to your queries automatically with odata.
public override IQueryable ApplyQuery(IQueryable queryable, ODataQueryOptions queryOptions)
{
return base.ApplyQuery(queryable, queryOptions);
}
Hi LeLong37,
I created a light version of your implementation for .NET Core. I Already use it in a production application.
Maybe it's helpful for others as well ? https://github.com/ferryferry/Patterns
I use the Urf package v5.1.0-beta but
If the package [CommonServiceLocator] is updated to the latest version [2.0.1], I get the following error :
exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
The error is gone if I use the version [1.3.0.0] of CommonServiceLocator package.
If the version 1.3.0.0 must be used then it should be explicitely setted in the nuget dependency no ?
Perhaps I am simply missing something obvious, but I am unable to see a way to perform a simple GroupBy on these generic repositories that will occur at the SQL level. Is this functionality currently supported by the generic repositories created by URF.NET?
I upgraded the old Repository.Pattern from 3.3.4 to Urf.Repository.Pattern 4.2 and I started getting the following exception
Could not load file or assembly 'Urf.Repository.Pattern, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Exception thrown: 'System.BadImageFormatException' in mscorlib.dll
An exception of type 'System.BadImageFormatException' occurred in mscorlib.dll but was not handled in user code
Could not load file or assembly 'Urf.Repository.Pattern, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I am using unity framework for entity framework 6 WCF project and i can't find PerRequestLifetimeManager in the assembly. i am using unity version 5.3.2
Hi when i try to Query().SelecPage() its throw exception
System.NotSupportedException: The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.
Also i thing QueryFluent and QueryObject not orm independent can you move them common project
Thank you
Applies to 4.2.
If a transaction is started with UnitOfWork, it is not explicitly closed in the Dispose method. The _transaction field in class UnitOfWork should be checked and disposed as needed.
It looks like a logical next step to support cosmosdb sql api query and associated repositories.
What's the ETA for URF.NET with .NET Core 2.1?
.NET Core 2.1 RC 1 is out!
Windows 7 ? Visual Studio 2013 ? asp.net 4.5 ?
Hi
Do you have ready Nhibernate and Dapper Implementation example
Would like to get some advice on how to approach Soft Deletes for our tables. If we assume that all tables in our Database have a IsDeleted bit. What would be the best approach for the following
Marking Related Entities for Delete
Filter related Entities after delete once they are deleted
This will load a reference property.
IRepository
:
void LoadProperty(TEntity item, Expression<Func<TEntity, object>> property);
IRepositoryAsync
:
Task LoadProperty(TEntity item, Expression<Func<TEntity, object>> property);
Repository
(.NET Core implementation -- will be different for EF 6.x):
public void LoadProperty(PlexApp item, Expression<Func<PlexApp, object>> property) => _context.Entry(item).Reference(property).Load();
public async Task LoadProperty(PlexApp item, Expression<Func<PlexApp, object>> property) => await _context.Entry(item).Reference(property).LoadAsync();
I am unable to insert when there is one or more owned entities (no nested entities).
It's working with DBContext.
Using:
Exception:
The entity of type 'Entity' is sharing the table 'Entity' with entities of type 'Entity.OwnedEntity#OwnedEntity', but there is no entity of this type with the same key value '{Id: -2147482647}' that has been marked as 'Added'.
It's a known issue.
See: EF Core 2 Owned Entities and Temporary Work-Arounds
Would be nice to have a fix or at least a roadmap to fix this in the trackable entities.
Converting from MS Test to XUnit for overall better .NET testing framework, API's as well as X-Plat compatibility e.g. running/compiling w/ Travis CI etc.
Best code on the web for repo pattern. Thanks for the extremely hard work I know it took to write this.
Let's refactor the full URF so that there is a Core package that does not depend on ITrackable or IQueryable. Then create separate packages for those bits that do depend on these interfaces.
Hi lelong37,
I showed you missing Context.ApplyChanges(entity) in method Repository.DeleteAsync
public virtual async Task DeleteAsync(CancellationToken cancellationToken, params object[] keyValues)
{
var entity = await FindAsync(cancellationToken, keyValues);
if (entity == null)
{
return false;
}
entity.TrackingState = TrackingState.Deleted;
return true;
}
Please fix to DeleteAsync
Thank you
Hi Mr Longle,
I used to use your framework in my project, but now when install URF.Repository framework, There is a issues with me:
Could not load file or assembly 'Urf.Repository.Pattern' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Can you help me resolve it
Hey guys,
Amazing solution, really learning a lot as i go thru it. but I cant seem to get past the delete methods in the Service. In your sample repo, or in the live demo on azure.
Please advise.
Thanks again for sharing your expertise
--brian
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.