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