mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 03:32:57 +00:00
RecordParser
This commit is contained in:
parent
7b7723201b
commit
c87ae22238
@ -8,6 +8,7 @@ using Esiur.Data;
|
||||
using Esiur.Resource.Template;
|
||||
using System.Linq;
|
||||
using Esiur.Misc;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace Esiur.Data;
|
||||
|
||||
@ -170,7 +171,13 @@ public static class DataDeserializer
|
||||
{
|
||||
var ar = (object[])r;
|
||||
|
||||
if (template.DefinedType != null)
|
||||
if (template == null)
|
||||
{
|
||||
// @TODO: add parse if no template settings
|
||||
reply.TriggerError(new AsyncException(ErrorType.Management, (ushort)ExceptionCode.TemplateNotFound,
|
||||
"Template not found for record."));
|
||||
}
|
||||
else if (template.DefinedType != null)
|
||||
{
|
||||
var record = Activator.CreateInstance(template.DefinedType) as IRecord;
|
||||
for (var i = 0; i < template.Properties.Length; i++)
|
||||
@ -198,6 +205,7 @@ public static class DataDeserializer
|
||||
|
||||
reply.Trigger(record);
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
@ -205,21 +213,18 @@ public static class DataDeserializer
|
||||
{
|
||||
initRecord(template);
|
||||
}
|
||||
else
|
||||
else if (connection != null)
|
||||
{
|
||||
// try to get the template from the other end
|
||||
connection.GetTemplate((Guid)classId).Then(tmp =>
|
||||
{
|
||||
ListParser(data, offset, length, connection, requestSequence).Then(r =>
|
||||
{
|
||||
if (tmp == null)
|
||||
reply.TriggerError(new AsyncException(ErrorType.Management, (ushort)ExceptionCode.TemplateNotFound,
|
||||
"Template not found for record."));
|
||||
else
|
||||
initRecord(tmp);
|
||||
|
||||
});
|
||||
initRecord(tmp);
|
||||
}).Error(x => reply.TriggerError(x));
|
||||
}
|
||||
else
|
||||
{
|
||||
initRecord(null);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user