public static void Register(SchemaBuilder sb, PropertyRoute route, BigStringConfiguration config) { if (sb.Schema.Tables.ContainsKey(route.RootType)) { throw new InvalidOperationException($"{route.RootType} is already included in the Schema. You need to call BigStringLogic.Register earlier in your Starter.Start method."); } if (route.PropertyInfo !.GetCustomAttribute <NotifyChildPropertyAttribute>() == null) { throw new InvalidOperationException($"BigString {route} should have a [NotifyChildPropertyAttribute]."); } if (config.Mode == BigStringMode.Database) { sb.Schema.Settings.FieldAttributes(route.Add(typeof(BigStringMixin)).Add(piFile)) !.Add(new IgnoreAttribute()); } else { if (config.Mode == BigStringMode.File) { sb.Schema.Settings.FieldAttributes(route.Add(piText)) !.Add(new IgnoreAttribute()); } if (config.FileTypeSymbol == null) { throw new InvalidOperationException($"{config.Mode} requires a FileTypeSymbol"); } } Configurations.Add(route, config); }
public static void RegisterAll <T>(SchemaBuilder sb, BigStringConfiguration config) where T : Entity { var routes = PropertyRoute.GenerateRoutes(typeof(T)).Where(a => a.PropertyRouteType == PropertyRouteType.FieldOrProperty && a.Type == typeof(BigStringEmbedded)).ToList(); foreach (var route in routes) { Register(sb, route, config); } }
public static void Register <T>(SchemaBuilder sb, Expression <Func <T, BigStringEmbedded> > expression, BigStringConfiguration config) where T : Entity { Register(sb, PropertyRoute.Construct(expression), config); }