23 changed files with 270 additions and 138 deletions
@ -0,0 +1,16 @@ |
|||
using DotNetCore.CAP.Internal; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.MessageService.Utils |
|||
{ |
|||
[Dependency(ServiceLifetime.Singleton, TryRegister = true)] |
|||
[ExposeServices(typeof(ISnowflakeIdGenerator))] |
|||
public class SnowflakeIdGenerator : ISnowflakeIdGenerator |
|||
{ |
|||
public long Create() |
|||
{ |
|||
return SnowflakeId.Default().NextId(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using System; |
|||
|
|||
namespace Newtonsoft.Json |
|||
{ |
|||
public class HexLongConverter : JsonConverter |
|||
{ |
|||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) |
|||
{ |
|||
long v = value is ulong ? (long)(ulong)value : (long)value; |
|||
writer.WriteValue(v.ToString()); |
|||
} |
|||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) |
|||
{ |
|||
string value = reader.Value as string; |
|||
long lValue = long.Parse(value); |
|||
return typeof(ulong) == objectType ? (object)(ulong)lValue : lValue; |
|||
} |
|||
public override bool CanConvert(Type objectType) |
|||
{ |
|||
switch (objectType.FullName) |
|||
{ |
|||
case "System.Int64": |
|||
case "System.UInt64": |
|||
return true; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +1,18 @@ |
|||
using Volo.Abp.Modularity; |
|||
using LINGYUN.Abp.MessageService.Mapper; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.MessageService |
|||
{ |
|||
[DependsOn(typeof(AbpAutoMapperModule))] |
|||
public class AbpMessageServiceDomainModule : AbpModule |
|||
{ |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
options.AddProfile<MessageServiceDomainAutoMapperProfile>(validate: true); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue