Last post Sep 15, 2016 11:34 AM by Mikesdotnetting
Sep 13, 2016 09:18 AM|sudip_inn|LINK
suppose i am writing class in few folders in my project. i want migrate will read only classed from a specific folder like model folder and not from other folder. so tell me how could i provide this info to EF migration?
is there any annotation which i can use for a class as a result EF migration will ignore that class during migration command ?
Sep 13, 2016 09:35 AM|Mikesdotnetting|LINK
You can use the NotMapped attribute:
public class MyClass
or you can use the Fluent API to configure it using the Ignore method:
protected override void OnModelCreating(ModelBuilder modelBuilder)
Sep 14, 2016 08:23 AM|sudip_inn|LINK
i have test your first code but that fail to solve my situation. i did test your second one
below two approach works for me.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
code taken from here http://stackoverflow.com/a/6143116/6188148
we can follow this approach too.
public partial class AddingvwCustomer : DbMigration
public override void Up()
public override void Down()
Sep 15, 2016 11:34 AM|Mikesdotnetting|LINK
I don;t understand how your "solution" addressed your question. Perhaps you meant something else rather than wanting to exclude a class from migration?