Comments (5)
Hi, @mehmet-erdogdu, looks like the entity doesn't contain information about table name, could you please provide your Users and Transactions models code to reproduce the issue?
from laraue.efcoretriggers.
I'm having the same issue. What do you mean that entity doesn't contain information about table name? All I can think about is to specify e.g.: builder.ToTable("TableName");
Is there something else that you have in mind?
from laraue.efcoretriggers.
I had this error when building a trigger for an entity that DbSet hasn't been added to DbContext. The readable exception was added for this case.
from laraue.efcoretriggers.
Hi,
the issue seems to appear when using inheritance. Consider this example:
public abstract class BaseModel
{
public Guid Id { get; set; }
}
public class Product: BaseModel
{
// ...
}
and in DbContext:
public DbSet<Product> Products { get; set; }
and somewhere in your trigger use ... , product) => product.Id === ...)
.
GetColumnName(MemberInfo memberInfo)
gets the MemberInfo of that expression which has BaseModel
as DeclaringType
and not Product
which is the type that is used as a table.
Adding .Entity<BaseModel>().ToTable("Whatever")
can cause other issues if you did not intend ModelBase
to be a table.
from laraue.efcoretriggers.
@portno I encountered this today with a slightly more complex setup. In my case, the base model had not been configured before the Trigger configuration runs on the builder. A simple hack that worked for me was changing the order of my IEntityTypeConfiguration<TType>
from:
public class MyTypeConfiguration : IEntityTypeConfiguration<BaseModel>, IEntityTypeConfiguration<Product>
{
public void Configure(EntityTypeBuilder<BaseModel> builder)
{
builder.AfterInsert(....);
}
public void Configure(EntityTypeBuilder<Product> builder)
{
}
}
public class MyTypeConfiguration : IEntityTypeConfiguration<Product>, IEntityTypeConfiguration<BaseModel>
{
public void Configure(EntityTypeBuilder<BaseModel> builder)
{
builder.AfterInsert(....);
}
public void Configure(EntityTypeBuilder<Product> builder)
{
}
}
I don't know if that will work for you, or what the root cause is just yet, but it might help
from laraue.efcoretriggers.
Related Issues (20)
- Cannot add package >=7.1.2 with project in .Net 6.0
- postgresql native SQL lack double quotes HOT 2
- postgresql native SQL translate error when Condition is x!=null HOT 1
- Refactor MigrationsModelDiffer to allow third-party changes
- Abort or modify incoming value on BeforeUpdate? HOT 5
- postgresql trigger/function name HOT 6
- Support to abstract entity
- Must RETURN OLD in function for *Delete triggers for PostgreSQL HOT 3
- ExecuteRawlSql doesn't work as I was imagining HOT 2
- Writing boolean constant to nullable boolean field in SqlServer trigger
- Recreate triggers after SQLite table rebuild
- ConvertTriggerAnnotationsToSql can't execute at the same time for a cached model
- Generated trigger names can be too long for MariaDB
- Table splitting seems to cause triggers unable to be created
- Support net8 HOT 2
- Add automatic Auditing capability for different table
- add a trigger for updating a specific column HOT 2
- Add triggers for generic types. HOT 3
- Support DateTime values HOT 2
- Support for mapped JSON types in Postgres
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laraue.efcoretriggers.