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)); }
static void ServerBroadcast_InvalidateTable(string cleanName) { Type type = TypeEntity.TryGetType(cleanName) !; var c = controllers.GetOrThrow(type) !; c.CachedTable.ResetAll(forceReset: false); c.NotifyInvalidated(); }
static void CacheInvalidator_ReceiveInvalidation(string tableName) { Type type = TypeEntity.TryGetType(tableName); var c = controllers.GetOrThrow(type); c.CachedTable.ResetAll(forceReset: false); c.NotifyInvalidated(); }
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)); }
public override string ToString() { var type = TypeEntity.TryGetType(TypeName); return(ChartMessage.ColorsFor0.NiceToString().FormatWith(type?.NiceName() ?? TypeName)); }