public override void Process(string entityName, List <JObject> datas) { lock (this) { Entity metadata; if (EntityMetadatas.TryGetValue(entityName, out metadata)) { var fileInfo = PrepareFile(Path.Combine(DataFolder, $"{metadata.Table.Database}.{metadata.Table.Name}.data")); StringBuilder builder = new StringBuilder(); foreach (var entry in datas) { builder.Append("@END@"); foreach (var column in metadata.Fields) { var value = entry.SelectToken($"$.{column.Name}")?.ToString(); if (!string.IsNullOrEmpty(value)) { builder.Append("#").Append(value).Append("#").Append("$"); } else { builder.Append("##$"); } } } File.AppendAllText(fileInfo.FullName, builder.ToString()); } } }
public override void Process(string entityName, List <JObject> items) { if (items == null || items.Count == 0) { return; } lock (this) { Entity metadata; if (EntityMetadatas.TryGetValue(entityName, out metadata)) { switch (Type) { case FileType.LoadFile: { SaveLoadFile(metadata, items); break; } case FileType.InsertSql: { SaveInsertSqlFile(metadata, items); break; } } } } }