예제 #1
0
        public static PropertyRoute Parse(string fullToString)
        {
            var typeParentheses = fullToString.Before('.');

            if (!typeParentheses.StartsWith("(") || !(typeParentheses.EndsWith(")") || typeParentheses.EndsWith("]")))
            {
                throw new FormatException("fullToString should start with the type between parentheses");
            }

            var startType = typeParentheses.IndexOf('(') + 1;
            var cleanType = typeParentheses.Substring(startType, typeParentheses.IndexOf(')') - startType);

            var type = TypeEntity.TryGetType(cleanType);

            if (type == null)
            {
                throw new FormatException("Type {0} is not recognized".FormatWith(typeParentheses));
            }

            var propertyRoute = fullToString.After(".");
            var startMixin    = typeParentheses.IndexOf("[");

            if (startMixin > 0)
            {
                propertyRoute = "{0}.{1}".FormatWith(typeParentheses.Substring(startMixin), propertyRoute);
            }

            return(Parse(type, propertyRoute));
        }
예제 #2
0
    static void ServerBroadcast_InvalidateTable(string cleanName)
    {
        Type type = TypeEntity.TryGetType(cleanName) !;

        var c = controllers.GetOrThrow(type) !;

        c.CachedTable.ResetAll(forceReset: false);

        c.NotifyInvalidated();
    }
예제 #3
0
        static void CacheInvalidator_ReceiveInvalidation(string tableName)
        {
            Type type = TypeEntity.TryGetType(tableName);

            var c = controllers.GetOrThrow(type);

            c.CachedTable.ResetAll(forceReset: false);

            c.NotifyInvalidated();
        }
예제 #4
0
        static object DeserializeLite(string str, Type defaultEntityType)
        {
            string idStr = str.Before(';');

            string tmp = str.After(';');

            string typeStr = tmp.Before(';');

            string toStr = tmp.After(';');

            Type type = string.IsNullOrEmpty(typeStr) ? defaultEntityType : TypeEntity.TryGetType(typeStr) !;

            return(Lite.Create(type, PrimaryKey.Parse(idStr, type), toStr));
        }
예제 #5
0
    public override string ToString()
    {
        var type = TypeEntity.TryGetType(TypeName);

        return(ChartMessage.ColorsFor0.NiceToString().FormatWith(type?.NiceName() ?? TypeName));
    }