kurumi
Reading large xml file from archive by using XmlReader in Parallel mode
Hello 👋. I am looking for how can I read data from archive xml file in Parallel mode.
I have archive
someFiles.zip
with my needed data and it has largeXmlFile.xml
file inside. This file is 40gb. It looks kinda of it (but has thousands of objects :Ok:):
Now I am opening this file from archive and get Stream
then putting this Stream
into XmlReader
:
And I am simply reading it:
It takes ages for reading this file, so my question is:
How can I change my code so I will read this XML in Parallel mode?35 replies
✅ AutoMapper record to class problems
I need to create map from
to:
I quickly made it:
So I want keep Id, AuthorId, Text and SendDate be mapped
But it throws exception:
AutoMapper.AutoMapperMappingException
Message=Error mapping types.
Source=AutoMapper
Inner Exception 1:
AutoMapperMappingException: Missing type map configuration or unsupported mapping.
So what I did wrong?
Surprising, this maps fine:
12 replies
✅ async .NET MAUI binding
Hello, on Xamarin channel I found this code how to update UI with threads and async stuff.
https://youtu.be/-LY4ATA8Bgw?si=cRmPMFNjL9-zTxui&t=1212
But in .NET MAUI it says
Warning CS0618 'Device.BeginInvokeOnMainThread(Action)' is obsolete: 'Use BindableObject.Dispatcher.Dispatch() instead'
. So how can I bind some async data from my API by using it?
Leave an example please 😄
5 replies
❔ REST API but it is HttpListener only available
Hello there, I got a challenge to write good scalable C# REST API app by using only .NET 7 (instead of ASP .NET) with HttpListener.
So I have some questions:
1) As I understood, it will only one
HttpListener
instance that catch all requests on different endpoints - not dedicated HttpListener
to dedicated endpoint?
2) After I catch connection, I should do httpListenerInstance.GetContextAsync()
and then transfer it to ThreadPool.QueueUserWorkItem
?
3) How to execute some logic on needed endpoint? I found an answer by notifying all endpoints like hey my dudes, it is new connection to /endpoint
can all of you handle it and execute if needed by checking itself context by using Observer pattern. But I see it may slower my system, is it any way to notify only 1 needed endpoint class?
4) ThreadPool.QueueUserWorkItem
or it is better to create custom class which will store ConcurrentQueue<HttpListenerContext>
with all my connections and then run another Task which will peak and notify endpoint func (see p.2 and p.3)?
Please leave good advices - I can not use sweety ASP .NET.30 replies