Laraue.EfCoreTriggers icon indicating copy to clipboard operation
Laraue.EfCoreTriggers copied to clipboard

Support for EF.Property (shadow properties)

Open Xriuk opened this issue 1 year ago • 0 comments

At the moment EF.Property is not supported. I tried adding it as an IMethodCallVisitor but it gives me an error:

Expression of type System.Linq.Expressions.TypedParameterExpression is not supported

I guess it's because of the first argument which is the instance of the entity.

I'm using it as argumentSelectors parameter in ExecuteRawSql with something like that:

modelBuilder.Entity<Brand>().InsteadOfDelete(a => a.Action(a => a.ExecuteRawSql("... = {0}", b => EF.Property<int>(b, "MyId"))));

but it think it should be the same in other expressions.

I would need this feature to allow triggers to target a shadow property (which is mapped to a column) of the entity, my question is: how can I replace this condition correctly? So that it gets added to the list of columns which get fetched into the cursor, and generates the correct SQL. I don't think IMethodCallVisitor is the most appropriate method at this point.

From a quick look at the code (specially the TriggerVisitor) I see that for each visited member should be declared on the entity, right?

Xriuk avatar Nov 09 '22 13:11 Xriuk