Dynamic columns support
For one of our client, we need to use the advanced MariaDb / MySql capability : dynamic columns declaration with BLOB. Is that possible with your EF Core connector ? For reference : https://mariadb.com/kb/en/dynamic-columns/
That feature is not supported and is unlikely to be introduced. With the little information that you've provided you could possibly implement IRelationalTypeMappingSourcePlugin to store your dynamic data in a JSON column.
We might take a look at it when we revise the JSON support, because both concepts share similarities.
@ChrisProlls Do you have some sample code how you would expect this to be used?
@mguinness thanks for you exemple, but this implementation doesn't use the dynamic columns feature of MariaDB like COLUMN_GET for querying.
The main advantages about dynamic columns are the reading part : all data are stored in a BLOB column, but you can query the dynamic column like they are classic column. Not sure if this can be translated easily from LINQ query...
Let try some example
public class Order {
public int Id { get; set; }
public string Title { get; set; }
public IDictionnary<string, object> Values { get; set; }
}
And in my OnModelCreating
builder.Entity<Order>.HasDynamicColumns(order => order.Values)
This should tell to the provider that Values should be translated to the BLOB column.
Then, when created an order :
var order = new Order { Title = "Test" }
order.Values.Add("first_dyn_column", "dynamic_value");
order.Values.Add("first_dyn_column_2", 1);
During creation of my order, Values should be translated to my BLOB column.
And for querying
context
.Set<Order>()
.Where(order => order.Values["first_dyn_column"] == "dynamic_value")