Click here to Skip to main content
15,885,278 members

Comments by bh_ (Top 18 by date)

bh_ 9-Mar-21 8:41am View    
Thanks for your reply and your time.

So, I do have what you describe as a DAL - this is a class library that I wrote to handle the actual interaction with the database.

But, since this class library does not have access to BLL's config files (appsettings.json in my case) then I need a way to send in the required connection string to the DAL from the BLL.

And that's what I'm doing here - the user makes their API query and specifies the server that will be used. Then the BLL uses this decision to extract a connection string from appsettings.json and it sends it to the DAL which is responsible for doing the actual work with the database.

Does this sound correct to you? Well... I suppose it *is* correct in that it definitely works. But would your appraisal of that be good or bad?
bh_ 1-Sep-18 8:45am View    
Yes this makes perfect sense. Thank you Graeme!

I was mainly concerned that I was not using the MVVM framework as it is intended and I didn't want to carry on writing an entire application just for it to be pointed out that I was totally misunderstanding what I was supposed to be doing.

You have given me the confidence to proceed and I consider the question answered, thanks!
bh_ 1-Sep-18 7:40am View    
Thanks for the response Graeme. I believe you have slightly misunderstood my question: I want to inform the Model of a change in the ViewModel, not the other way around.
However, your answer is still useful as I am confused about this exchange of information more generally and that is really the purpose of my question.

So, inevitably the ViewModels and the Models will be linked through code like this and there will not be 100% seperation of concerns. It seems that there cannot be: how else can the Models do useful work in response to changes to the ViewModels?

That said I think I am also misunderstanding the purpose of Models. It is explained in many tutorials that the Models contain your data and this drives the ViewModel to inform the GUI of changes to data.
This makes sense with the direction in which you have answered my question.

But I have a different application to this. I have pieces of equipment which do things, and I can set the equipment up and operate them from the GUI. So it seems to me that the data flow is more from ViewModel -> Model than Model -> ViewModel. But also the data flow can be both ways I think?

I get the general impression that I am misunderstanding something fundamental about MVVM but so far no amount of googling or tutorial reading has helped me make progress.
bh_ 2-Sep-16 5:43am View    
That is a perfect solution, and exactly what I had in mind.

but... where can I learn more about the technique you have employed here?
bh_ 2-Sep-16 4:36am View    
Thanks very much for the response F-ES Sitecore. I have tried to improve my question. I will look into generics and reflection to see if either of these give me other ideas about how to solve the problem.