Load ObserverableCollection from RowSet
richbryant opened this issue · comments
When using [Rowset] annotations on an object, fill Child records into an ObservableCollection
Currently, if you try this, you get "Operation may destabilize the runtime" and it's lengthy workaround time.
If I have this piece of code on an AutoInterface -
[Sql("Stages_GetByCycle")]
[Recordset(1, typeof(Instruction), Id = nameof(Instruction.Id), GroupBy = nameof(Instruction.StageId), Into = nameof(Stage.Instructions), IsChild = true)]
IEnumerable<Stage> GetByCycle(long id);
and Stage.Instructions is a List or IEnumerable, it's fine. No problem. But really, I'd like for it to be an ObservableCollection so that I can eliminate largely useless ViewModels from my application.
Is there any way to achieve this?
It would involve updating the collection injection code to create a new type of list. Not impossible but not a trivial task. I won’t have time to tackle it in the near term.
Options:
1) if you’re up for doing the work for a PR, I can outline the steps.
2) workaround by doing Into=Stage.InstructionSetter
Where the setter translates from List to ObservableCollection. Shouldn’t be a large performance hit. But you would have to do it anywhere you need that translation.
Keeping this open because I think it’s a good feature.
On Jun 12, 2019, at 7:28 AM, Rich Bryant <notifications@github.com<mailto:notifications@github.com>> wrote:
When using [Rowset] annotations on an object, fill Child records into an ObservableCOllection
Currently, if you try this, you get "Operation may destabilize the runtime" and it's lengthy workaround time.
If I have this piece of code on an AutoInterface -
[Sql("Stages_GetByCycle")]
[Recordset(1, typeof(Instruction), Id = nameof(Instruction.Id), GroupBy = nameof(Instruction.StageId), Into = nameof(Stage.Instructions), IsChild = true)]
IEnumerable<Stage> GetByCycle(long id);
and Stage.Instructions is a List or IEnumerable, it's fine. No problem. But really, I'd like for it to be an ObservableCollection so that I can eliminate largely useless ViewModels from my application.
Is there any way to achieve this?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#398?email_source=notifications&email_token=AAMTO5CQN56RMQ764AE24TDP2DMXPA5CNFSM4HXH7XIKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GZBFXSQ>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAMTO5D7FJEGOIOOLRQ3F2TP2DMXPANCNFSM4HXH7XIA>.
Absolutely! Tell me the steps, I'll have a crack at it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.