Ejemplo n.º 1
0
    public override async Task Load(XElement node, bool requireName = true)
    {
        await base.Load(node, requireName);

        var keyedValueNode = node.Element(XName.Get("KeyedValue", LoquiGenerator.Namespace));

        if (keyedValueNode != null)
        {
            var dictType = new DictType_KeyedValue();
            dictType.SetObjectGeneration(ObjectGen, setDefaults: false);
            subGenerator = dictType;
            await subGenerator.Load(node, requireName);

            subDictGenerator = dictType;
        }
        else
        {
            var dictType = new DictType_Typical();
            dictType.SetObjectGeneration(ObjectGen, setDefaults: false);
            subGenerator = dictType;
            await subGenerator.Load(node, requireName);

            subDictGenerator = dictType;
        }
    }
Ejemplo n.º 2
0
        public DictType()
        {
            if (isMultiDatabase)
            {
                base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, dicmultiDatabase[this.GetType().Name].ToString());
            }
            else
            {
                base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
            }

            baseDal.OnOperationLog += new OperationLogEventHandler(OperationLog.OnOperationLog);//如果需要记录操作日志,则实现这个事件

            dal = baseDal as IDictType;
        }
Ejemplo n.º 3
0
    public static string GetSubMaskString(IDictType dictType, string typeStr, bool getter)
    {
        LoquiType keyLoquiType   = dictType.KeyTypeGen as LoquiType;
        LoquiType valueLoquiType = dictType.ValueTypeGen as LoquiType;

        switch (dictType.Mode)
        {
        case DictMode.KeyValue:
            if (valueLoquiType != null)
            {
                return($"{(valueLoquiType == null ? $"({dictType.KeyTypeGen.TypeName(getter)} Key, {typeStr} Value)" : $"MaskItemIndexed<{dictType.KeyTypeGen.TypeName(getter)}, {typeStr}, {valueLoquiType.GetMaskString(typeStr)}?>")}");
            }
            else
            {
                string keyStr   = $"{(keyLoquiType == null ? dictType.KeyTypeGen.TypeName(getter: true) : $"MaskItem<{typeStr}, {keyLoquiType.GetMaskString(typeStr)}?>")}";
                string valueStr = $"{(valueLoquiType == null ? typeStr : $"MaskItem<{typeStr}, {valueLoquiType.GetMaskString(typeStr)}?>")}";
                return($"KeyValuePair<{keyStr}, {valueStr}>");
            }
Ejemplo n.º 4
0
        internal RequestHandlerCollection(RequestHandlerCollection parent = null)
        {
            inner = list;

            var temp = parent;

            while (temp != null)
            {
                if (temp == this)
                    throw new Exception("Circular reference!");
                //  Anti-self-idiocy
                temp = temp.parent;
            }

            this.parent = parent;

            syncRoot = ((System.Collections.ICollection)list).SyncRoot;
        }
Ejemplo n.º 5
0
        public override void Load(XElement node, bool requireName = true)
        {
            base.Load(node, requireName);

            var keyedValueNode = node.Element(XName.Get("KeyedValue", NoggolloquyGenerator.Namespace));

            if (keyedValueNode != null)
            {
                var dictType = new DictType_KeyedValue();
                dictType.ObjectGen = this.ObjectGen;
                subGenerator       = dictType;
                subGenerator.Load(node, requireName);
                subDictGenerator = dictType;
            }
            else
            {
                var dictType = new DictType_Typical();
                dictType.ObjectGen = this.ObjectGen;
                subGenerator       = dictType;
                subGenerator.Load(node, requireName);
                subDictGenerator = dictType;
            }
        }
Ejemplo n.º 6
0
 public static string GetMaskString(IDictType dictType, string typeStr, bool getter)
 {
     return($"MaskItem<{typeStr}, IEnumerable<{GetSubMaskString(dictType, typeStr, getter)}>?>");
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取指定ID下的树形结构列表
        /// </summary>
        /// <param name="mainID">字典类型ID</param>
        /// <returns></returns>
        public List <DictTypeNodeInfo> GetTreeByID(string mainID)
        {
            IDictType typeDal = baseDal as IDictType;

            return(typeDal.GetTreeByID(mainID));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取字典类型顶级的列表
        /// </summary>
        /// <returns></returns>
        public List <DictTypeInfo> GetTopItems()
        {
            IDictType typeDal = baseDal as IDictType;

            return(typeDal.GetTopItems());
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 获取字典类型的树形结构列表
        /// </summary>
        /// <returns></returns>
        public List <DictTypeNodeInfo> GetTree()
        {
            IDictType typeDal = baseDal as IDictType;

            return(typeDal.GetTree());
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取所有字典类型的列表集合(Key为名称,Value为ID值)
        /// </summary>
        /// <param name="dictTypeId">字典类型ID</param>
        /// <returns></returns>
        public Dictionary <string, string> GetAllType(string dictTypeId)
        {
            IDictType typeDal = baseDal as IDictType;

            return(typeDal.GetAllType(dictTypeId));
        }
Ejemplo n.º 11
0
 public DictTypeService(IDictType dao)
 {
     this.dao = dao;
 }
 public override void GenerateForField(FileGeneration fg, TypeGeneration field, string typeStr)
 {
     IDictType dictType      = field as IDictType;
     NoggType  keyNoggType   = dictType.KeyTypeGen as NoggType;
     NoggType  valueNoggType = dictType.ValueTypeGen as NoggType;
     string    valueStr      = $"{(valueNoggType == null ? typeStr : $"MaskItem<{typeStr}, {valueNoggType.RefGen.Obj.GetMaskString(typeStr)}>")}";