public static Result <ResourceEdmx> HexToBase64(DatabaseEdmx databaseEdmx) => FlowHelpers.With(databaseEdmx) .Map(edmx => HexModule.CutOffHexPrefix(databaseEdmx.Value)) .OnSuccessTry <Hex, ByteArray, FormatException>(edmx => HexToBytes(edmx), "Invalid hexidecimal format.") .OnSuccess(edmx => Base64Module.BytesToBase64(edmx)) .OnSuccess(base64 => base64.ToResourceEdmx());
public static Result <ResourceEdmx> GZipToBase64(GZipBinary source) => FlowHelpers.With(source) .OnSuccess(edmx => Base64Module.BytesToBase64(edmx.ByteArray) .OnSuccess(base64 => new ResourceEdmx(base64)));
internal static Result <Edmx> ConvertToDatabase(ResourceEdmx xmlEdmx) => Base64Module.Base64ToByteArray(xmlEdmx) .OnSuccess(edmx => MiscModule.BytesToHex(edmx)) .Map(edmx => edmx.ToDatabaseEdmx()) .Map(edmx => edmx as Edmx);