fix marten
parent
738a4d523c
commit
d17422d646
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"ConnectionStrings": {
|
||||
"PostgresServer": "Host=185.220.227.39;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopDB;Application Name=NetinaShopApi",
|
||||
"PostgresServer": "Host=185.220.227.29;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopDB;Application Name=NetinaShopApi",
|
||||
"Postgres": "Host=pg-0;Username=postgres;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopDB",
|
||||
"MartenDB": "Host=pg-0;Username=postgres;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopMartenDB"
|
||||
},
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<AssemblyVersion>1.5.17.26</AssemblyVersion>
|
||||
<FileVersion>1.5.17.26</FileVersion>
|
||||
<AssemblyVersion>1.5.18.27</AssemblyVersion>
|
||||
<FileVersion>1.5.18.27</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -72,7 +72,7 @@ public static class ServiceExtensions
|
|||
serviceCollection.AddDbContextFactory<ApplicationContext>(options =>
|
||||
{
|
||||
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
|
||||
options.UseNpgsql(Configuration.GetConnectionString("PostgresServer"), b => b.MigrationsAssembly("Netina.Repository"))
|
||||
options.UseNpgsql(Configuration.GetConnectionString("Postgres"), b => b.MigrationsAssembly("Netina.Repository"))
|
||||
.UseProjectAssembly(typeof(ApplicationUser).Assembly);
|
||||
|
||||
//options.EnableServiceProviderCaching(true);
|
||||
|
|
|
@ -19,23 +19,23 @@ public class MartenEntity : IMartenEntity
|
|||
|
||||
|
||||
|
||||
public bool Equals(ApiEntity other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return Id.Equals(other.Id);
|
||||
}
|
||||
//public bool Equals(ApiEntity other)
|
||||
//{
|
||||
// if (ReferenceEquals(null, other)) return false;
|
||||
// if (ReferenceEquals(this, other)) return true;
|
||||
// return Id.Equals(other.Id);
|
||||
//}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
return Equals((ApiEntity)obj);
|
||||
}
|
||||
//public override bool Equals(object obj)
|
||||
//{
|
||||
// if (ReferenceEquals(null, obj)) return false;
|
||||
// if (ReferenceEquals(this, obj)) return true;
|
||||
// if (obj.GetType() != this.GetType()) return false;
|
||||
// return Equals((ApiEntity)obj);
|
||||
//}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Id.GetHashCode();
|
||||
}
|
||||
//public override int GetHashCode()
|
||||
//{
|
||||
// return Id.GetHashCode();
|
||||
//}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
namespace Netina.Domain.Entities.Products;
|
||||
using System.Net;
|
||||
|
||||
namespace Netina.Domain.Entities.Products;
|
||||
|
||||
public partial class Product
|
||||
{
|
||||
|
@ -12,7 +14,7 @@ public partial class Product
|
|||
Guid brandId,
|
||||
Guid categoryId, Guid authorId)
|
||||
{
|
||||
var slug = StringExtensions.GetSlug(persianName);
|
||||
var slug = WebUtility.UrlEncode(persianName.Replace(' ', '-'));
|
||||
return new Product(
|
||||
persianName,
|
||||
englishName,
|
||||
|
|
|
@ -20,11 +20,12 @@ public class MartenRepository<TMartenEntity>(IDocumentStore documentStore, ICurr
|
|||
public async Task<List<TMartenEntity>> GetEntitiesAsync(int page, int count, CancellationToken cancellation)
|
||||
{
|
||||
await using var session = documentStore.QuerySession();
|
||||
var entities = await session
|
||||
.Query<TMartenEntity>()
|
||||
var schema = session.DocumentStore.Options.Schema;
|
||||
var entities = session
|
||||
.Query<TMartenEntity>($"select data from {schema.For<TMartenEntity>()} ORDER BY \"mt_last_modified\" DESC " )
|
||||
.Skip(page * count)
|
||||
.Take(count)
|
||||
.ToListAsync(cancellation);
|
||||
.ToList();
|
||||
return entities.ToList();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue