-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include doesn't work sometimes #4284
Comments
@smitpatel is this a dupe of an issue you have already fixed? |
@smitpatel #3994 was the issue I was thinking this is probably a dupe of @Erwandebenaze can you provide a link to the source of your project? I couldn't see a Skylord repo on your user profile. |
@rowanmiller https://github.com/ITISkyLord/SkyLord.git it's on the branch Events. I have temporaly added a "UnitIdd" on my database to pass throught the problem. To generate the problem (the site is in french :/) : Hope it's clear. I hope it's not a draft for you.. PS : You have to update the database with SetupContext : dnx ef database update -c SetupContext |
@rowanmiller I reproduct the same thing in a test and it works perfectly... |
@Erwandebenaze I tried reproducing this... I am able to run the application, and follow the steps down to |
BTW I assume I was supposed to uncomment the line that was commented out in Resolve public void Resolve( UnitEvent ue )
{
// À remettre en place quand on aura la solutions pour Include
// /!\ HERE IS THE PROBLEM with Include. /!\
UnitEvent unitEvent = _context.UnitEvents.Include(a=>a.Unit).ThenInclude( b => b.UnitStatistics ).Where( e => e.EventId == ue.EventId ).First();
Unit unit = _context.Units.Include( y => y.UnitStatistics ).Where( u => u.UnitId == ue.UnitIdd ).Single();
ArmyManager am = _allManager.ArmyManager;
am.AddUnit( unit, 1, ue.Island );
// TODO : Si plusieurs lignes sont finies en même temps, on peut les cumuler avec ArmyManager.AddUnit
} |
Oh ? Try to coment Unit unit = _contre.Units .... Like that : // /!\ HERE IS THE PROBLEM with Include. /!\
UnitEvent unitEvent = _context.UnitEvents.Include(a=>a.Unit).ThenInclude( b => b.UnitStatistics ).Where( e => e.EventId == ue.EventId ).First();
// Unit unit = _context.Units.Include( y => y.UnitStatistics ).Where( u => u.UnitId == ue.UnitIdd ).Single();
ArmyManager am = _allManager.ArmyManager;
am.AddUnit( unitEvent.Unit, 1, ue.Island ); The exception is thrown everytime for me... |
On the Armées page, if I click At this stage I have spent several hours trying to repro this issue and have not get anywhere. If you want us to look at this further then I really need you to provide a project that I can open and run to reproduce the issue (preferably a unit test or console app). For example, here is the type of repro code we need to get to in order to address the issue - #4155 (comment). |
I understand and I thank you for the time that you spent to help us. Our project isn't very stable that's why it's hard. This problem geeve me headaches and i thought you could maybe help me with just seeing my code. However if you want to understand the problem I could maybe geeve you a better version in February after our rush. Again, thanks very much for your attention and sorry to geeve you this "draft" code... |
Yes, if you are able to provide some code and instructions that can reliably reproduce the issue then please do send them thru. I'll close this one out now and you can either open a new issue or re-open this one later. |
Hi !
(Sorry for my english)
For my student project I have a Database with lots of tables but only 3 are concerned here.
First one is in TPH :
With the second one who implement Event
The table Event take others class like UnitEvent (ArmyEvent, BuildingEvent, TechnoEvent etc...)
The TPH works and all data are binded.
This is the class Unit :
The problem is in the line :
It throw IndexOutOfRangeException
Withtout the Include(a=>a.Unit), the query works.
An other query, juste before on the same table I have
This is my project.json
Thank for your help.
If needed, my project "Skylord" is on github, branch Event.
Bye !
The text was updated successfully, but these errors were encountered: