Identyfikacja Trendów
Identyfikacja Trendów w Handlu Kontraktami Futures na Kryptowaluty
Identyfikacja trendów jest kluczową umiejętnością w handlu kontraktami futures na kryptowaluty. Zrozumienie, jak rozpoznawać i interpretować trendy, może znacząco wpłynąć na skuteczność Twoich strategii handlowych. W tym artykule omówimy podstawowe koncepcje związane z identyfikacją trendów, narzędzia analizy technicz<issue_start><issue_comment>Title: Unable to determine the relationship represented by navigation property 'SomeEntity.SomeRelatedEntity' of type 'SomeRelatedEntity'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. username_0: I have the following issue when trying to run some migrations. I think the issue is related to the fact that I have a class that has a property that references another class, but this property is not directly a navigation property (it's not a collection of the other entity, neither it is a direct reference to the other entity). Instead, it has a type of an interface, which might be implemented by the other entity. Here are the details:
- The entities:**
```csharp public class SomeEntity : IEntity {
public int Id { get; set; } public int? SomeRelatedEntityId { get; set; } public ISomeRelatedEntity SomeRelatedEntity { get; set; }
}
public class SomeRelatedEntity : ISomeRelatedEntity, IEntity {
public int Id { get; set; }
} ```
- The interfaces:**
```csharp public interface IEntity {
int Id { get; set; }
}
public interface ISomeRelatedEntity { } ```
- The fluent configuration in the `OnModelCreating` method:**
```csharp protected override void OnModelCreating(ModelBuilder modelBuilder) {
modelBuilder.Entity<SomeEntity>(entity => { entity.HasOne(e => e.SomeRelatedEntity) .WithMany() .HasForeignKey(e => e.SomeRelatedEntityId); });
} ```
When I run `Add-Migration`, I get the following error: ``` Unable to determine the relationship represented by navigation property 'SomeEntity.SomeRelatedEntity' of type 'ISomeRelatedEntity'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'. ```
Is there a way to make this work without changing the property type to `SomeRelatedEntity`? I would like to keep it as `ISomeRelatedEntity` for abstraction purposes. <issue_comment>username_1: @username_0 EF Core does not support mapping interfaces. See https://github.com/dotnet/efcore/issues/9630 for more information. The reason for this is that it isn't clear what concrete type should be mapped. For example, if you have another type implementing the interface, which type should be used? What if two types implement the interface? Which one should be used? What if one type is added later? Should it be automatically picked up? Etc.
The way to work around this is to add a shadow property to the entity type for the concrete type that should be used. For example:
```C# modelBuilder.Entity<SomeEntity>(entity => {
entity.Property<SomeRelatedEntity>("SomeRelatedEntity");
entity.HasOne(e => e.SomeRelatedEntity) .WithMany() .HasForeignKey(e => e.SomeRelatedEntityId);
}); ```<issue_closed>
Polecane platformy handlu kontraktami futures
Platforma | Funkcje futures | Rejestracja |
---|---|---|
Binance Futures | Dźwignia do 125x, kontrakty USDⓈ-M | Zarejestruj się teraz |
Bybit Futures | Kontrakty perpetualne odwrotne | Rozpocznij handel |
BingX Futures | Handel kopiujący dla futures | Dołącz do BingX |
Bitget Futures | Kontrakty z marżą USDT | Otwórz konto |
Dołącz do społeczności
Zasubskrybuj kanał Telegram @strategybin po więcej informacji. Najbardziej zyskowna platforma kryptowalut - zarejestruj się tutaj.
Weź udział w naszej społeczności
Zasubskrybuj kanał Telegram @cryptofuturestrading dla analiz, darmowych sygnałów i więcej!