Exemplo n.º 1
0
        internal static async ValueTask <string> LoadViewRuntimeCode(ulong viewModelId)
        {
            var developerID = RuntimeContext.Current.CurrentSession.LeafOrgUnitID;

#if FUTURE
            var q = new TableScan(Consts.SYS_STAGED_MODEL_ID);
            q.Filter(q.GetGuid(Consts.STAGED_DEVELOPERID_ID) == developerID &
                     q.GetString(Consts.STAGED_MODELID_ID) == viewModelId.ToString() &
                     q.GetByte(Consts.STAGED_TYPE_ID) == (byte)StagedType.ViewRuntimeCode);
#else
            var q = new SqlQuery(Consts.SYS_STAGED_MODEL_ID);
            q.Where(q.T["DeveloperId"] == developerID &
                    q.T["ModelId"] == viewModelId.ToString() &
                    q.T["Type"] == (byte)StagedType.ViewRuntimeCode);
#endif
            var res = await q.ToListAsync();

            if (res == null || res.Count == 0)
            {
                return(null);
            }

            var data = res[0].GetBytes(Consts.STAGED_DATA_ID);
            ModelCodeUtil.DecodeViewRuntimeCode(data, out string runtimeCode);
            return(runtimeCode);
        }
Exemplo n.º 2
0
        internal static async Task <string> LoadReportCodeAsync(ulong modelId)
        {
            var data = await LoadCodeDataAsync(modelId);

            if (data == null)
            {
                return(null);
            }
            return(ModelCodeUtil.DecompressCode(data));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 专用于加载服务模型代码
        /// </summary>
        internal static async ValueTask <string> LoadServiceCode(ulong serviceModelId)
        {
            var data = await LoadCodeDataAsync(serviceModelId);

            if (data == null)
            {
                return(null);
            }
            ModelCodeUtil.DecodeServiceCode(data, out string sourceCode, out _);
            return(sourceCode);
        }
Exemplo n.º 4
0
        internal static Task SaveViewRuntimeCodeAsync(ulong modelId, string runtimeCode)
        {
            if (string.IsNullOrEmpty(runtimeCode))
            {
                return(Task.CompletedTask);
            }

            var data = ModelCodeUtil.EncodeViewRuntimeCode(runtimeCode);

            return(SaveAsync(StagedType.ViewRuntimeCode, modelId.ToString(), data));
        }
Exemplo n.º 5
0
        internal static async Task <ValueTuple <bool, string, string, string> > LoadViewCodeAsync(ulong modelId)
        {
            var data = await LoadCodeDataAsync(modelId);

            if (data == null)
            {
                return(ValueTuple.Create <bool, string, string, string>(false, null, null, null));
            }

            ModelCodeUtil.DecodeViewCode(data, out string templateCode, out string scriptCode, out string styleCode);
            return(ValueTuple.Create(true, templateCode, scriptCode, styleCode));
        }
Exemplo n.º 6
0
        internal static Task SaveReportCodeAsync(ulong modelId, string code)
        {
            var data = ModelCodeUtil.CompressCode(code);

            return(SaveAsync(StagedType.SourceCode, modelId.ToString(), data));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 专用于保存服务模型代码
        /// </summary>
        internal static Task SaveServiceCodeAsync(ulong modelId, string sourceCode)
        {
            var data = ModelCodeUtil.EncodeServiceCode(sourceCode, null);

            return(SaveAsync(StagedType.SourceCode, modelId.ToString(), data));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 专用于保存视图模型代码
        /// </summary>
        internal static Task SaveViewCodeAsync(ulong modelId, string templateCode, string scriptCode, string styleCode)
        {
            var data = ModelCodeUtil.EncodeViewCode(templateCode, scriptCode, styleCode);

            return(SaveAsync(StagedType.SourceCode, modelId.ToString(), data));
        }