✅ using using to clear up ambiguous references.
I've to two method called index:
Microsoft.EntityFrameworkCore.Index
System.ComponentModel.DataAnnotations.Schema.Index
i don't use the 2nd one. I want every mention of index to be interpreted as the first one.
I've tried adding one of these using's to fix the problem, but nether works, it just says it Cannot resolve symbol 'Index'
25 Replies
Do you need anything from Schema?
Alternatively: don't use data annotations and go with convention and fluent config
yep
if i dont use data annotations how do i get stuff like strings of limited length?
Wait, I don’t see an Index class in Schema in the docs.
no idea what that is
Got it! its
IndexAttribute
. not sure why is written different in the code...You can omit the Attribute suffix when using attributes.
Wait, is this EF or EF Core?
Core?
Oh jesus it’s from EF6.
Burn it
IndexAttribute Class (System.ComponentModel.DataAnnotations.Schema)
When this attribute is placed on a property it indicates that the database column to which the property is mapped has an index.
Yeah well throw away this namespace
i take it there is a better solution
Yes, don't use anything from this namespace
Is this a new or existing app? I forget.
Or use convention and fluent config
in development
That particular Index attrib isn’t available if you’re using EF Core it seems.
Show your csproj.
and i am still firugint out how to use EF now that its set up. am willing to throw EF out in favor of a better solution
FYI: EF and EF Core are two different things
EF yuck ugly old yuck don't
EF Core mmm pretty new mmm yes use
Wait, that is EF Core.
confused noises
solved it with this:
using Index = Microsoft.EntityFrameworkCore.IndexAttribute;
so it is EF coreYeah, so just don't use the
System.ComponentModel.DataAnnotations.Schema.Index
namespace anywhere
If you don't have a using
with that, and you have using Microsoft.EntityFrameworkCore
then only that one will be usedthats what i am doing right now