Shadowing Practice: .NET Mock Interview - Scenario Based - 7+ Years Experienced Candidate - Learn English Speaking with Video

Choose a practice mode

Each mode opens a full-screen practice room.

233 sentences
If sentences are too short or too long, click Edit to adjust them.
1
So this is an example of eager loading.
2
So we are just iterating one by one and it is increasing the round trip with the database and to avoid these,
3
it is a good because if we are not more than more rows in the database,
4
but if we have a 5 lakhs to 2 lakhs rows in the database, it is not a good.
5
So now what I will do is I will show you a piece of code.
6
So this is a simple get user method.
7
Okay.
8
We are getting the user details based on the user ID from database.
9
And this is an async method here and user service or async method.
10
And we are getting the result and we are assigning it to a variable user.
11
And then just we are returning the user.
12
This is the API simple method.
13
Okay.
14
Can you tell me is there any problem?
15
Can you improve this code?
16
Is there any missing in this code?
17
Do you think it is?
18
No, if we are using async, then we will have to apply the await and async keywords.
19
After the public, we need to add the await and we are getting the result.
20
User equals to await.
21
We need to write here.
22
yeah okay all right so yes so you are right
23
so basically the problem is that dot result this result will block the thread
24
so basically what will happen one thread will execute this port right
25
and your answer is right i'm just elaborating it okay so
26
but if this method that third is executing
27
if they get by idsing method is taking too much time then what will happen the thread will be blocked
28
and if the thread will block it is waiting
29
because then what will happen your application will be blocked
30
so the correct way to do is as you said and
31
that is here i have already written i don't want to type
32
so here a sync
33
and await keyword we have to use now what will happen this await will release the thread
34
so for example the thread one is executing this board okay now what will happen
35
if we are using uh a great the thread one will be released okay
36
because get by id async is taking time
37
so thread one will be released
38
and it will go back to the thread pool your thread one
39
and from the thread pool it will be allowed to do some different operation action function whatever okay
40
so your application will not be blocked the thread one keep on working on something else
41
and when the response is available then the thread one
42
or thread one or even some different thread okay whatever thread will be available will get the response
43
and it to the user and your recall in short your your operation will work smoothly
44
okay so this is the benefit of using a sync
45
and update here are you an experienced dotnet developer
46
but struggling to clear interviews knowing definition is not enough answering
47
scenario based questions can decide your selection in my free live.net interview workshop
48
i will explain how to prepare for interviews
49
if you are preparing for your next.net interview
50
then this workshop is for you register for free workshop on
51
6 september sunday 8 pm using the link in the description
52
we'll see you live suppose your application requires a user service which will
53
user service
54
which will handle the information about the user user class user service class you have you need a class
55
or a service you can say now how would you implement
56
and inject the service using dependency induction
57
so you can say can you tell the steps what you will do to from creating
58
this user service how you will create
59
and how you will inject in the uh you will use in your application
60
so user service i will inject using the adpob lifetime so
61
that means user service the instance of
62
that service needs only once in every user means every user request will create the new instance
63
so http request when the user login so every user means every user with each
64
So we will use scoped lifetime for dependency injections.
65
So if you talk about the practical thing,
66
build.add.service and we can add scope as injection and inside the bracket we can add the service name and then
67
then the parent test is we can apply okay okay so it's like uh
68
Basically, there is a series of steps when we are implementing some service.
69
First of all, we have to create an interface of that service.
70
I'm telling you because I asked the steps.
71
Okay, you asked some points which were part of the process,
72
but the complete process is like first we have to create one interface like i user service
73
and then we have to create the service itself by implementing
74
that interface okay so i user service
75
and we will class create the class user service implementing the i user service interface
76
then what we will do we will register the service the user service in the program.csv okay
77
so that by using how add scope which you have said correctly
78
but you will use a discord
79
and inside the type the angular brackets we will use i user service from my user service like this
80
so and we will register the service we could be we call this thing the three steps
81
so first interface second service third register the service
82
then fourth is inject the service by the controller oh sorry by the constructor
83
so for example you want the user service inside the user controller okay
84
there is a user controller
85
now either one way is you can create directly the object of the user service inside the user controller
86
but we will not create the object using the new keyword we will inside the user controller
87
we will call the user controller constructor
88
and there we will inject the user service as a parameter okay
89
and as soon as we uh in inject then the object will be created by the dotnet in the background
90
and that object underscore user service that so basically four steps
91
interface service register the service in the program
92
and finally constructor uh inside wherever
93
you want to use the user controller uh product controller in whatever controller you want to use it okay
94
so support those for a sp.net core application has a user service okay that manages
95
about user data use related things user service class okay user related functions are inside it
96
and then there is a logger service
97
that basically manages whenever you want something log there are function inside
98
which will managing the logs like if you want to log something then that kind of of functions are inside logger service.
99
Now, which dependency detection lifetime will you choose for user service, and which you will use for logger service?
100
For user service, I will choose scoped, because every user will create login with its credentials.
101
So every user can see their own application, their own information, not other.
102
If other user will logged in, the new instance will be generated.
103
And for logged, we will use singleton.
104
So singleton will be okay.
105
So it is create the once and it will use the lifetime of the application.
106
Yeah, correct.
107
So very much accurate.
108
For whenever we don't want to share the data, like in the user service case,
109
we don't want to share the user data of one request with another request.
110
Okay.
111
So that time we will use a scoped.
112
So one instance per HTTP request, one HTTP request, one instance.
113
But in logger service, it's okay to share the instance
114
across the application because we are just logging the information throughout the application.
115
There is nothing like, no critical information is there.
116
okay so singleton is better and singleton will make it more but there will be only one instance
117
then it will be good for performance because
118
if there are multiple instances for example in scope also for multiple requests there will be multiple instances one right
119
so performance will be slightly less but singleton performance will be very high
120
and transient is there where in
121
that case performance will be very much multiple instances will be there inside the request also okay suppose
122
you have a dotnet core application okay
123
and a request is coming to your dotnet application
124
and now in your dot application you have to check whether the request is containing some valid api key
125
or some valid authentication token some thing you have to check and if that
126
api key is for example missing
127
or invalid then your application should not process the request
128
and return an error response to the front end or from wherever the request is coming okay
129
so how you will implement some idea like how you will implement using the uh using the middleware
130
and the the idea is you have to use these method user
131
and map in a in a proper way so indication is different
132
that authentication before that authentication first you will check the whether the api has received some token
133
or not right first you have to it should not be blank right
134
when it have some token then the jwd authentication will start working to validate
135
that token that whether the token is correct or not okay so if the request don't have any token
136
then why to send it for disability authentication
137
you can initially using the middle words you can check it no idea okay okay no problem
138
so uh i will i will give one one minute
139
i will give some idea okay let me share my screen okay
140
so inside your program.cs file
141
so imagine this is your program.cs file here
142
you will use the use method okay
143
this is completely your use method up up until here let me make it short
144
so inside it you will check
145
this thing whether the you will try to extract the api key from the request header okay
146
this is the request this is the context request header and
147
if it has api
148
if you will receive the api key then you will run
149
this await next method have any idea about next method
150
that is also the part of the middleware
151
so next method will then run this map controllers okay but
152
if there is no api key then so
153
if this condition has api key is not means there is no api key then this code will be executed
154
and it will basically it's a sample don't just like it this code can be changed
155
but the logic you have to understand that use map
156
then we will return to stop the pipeline
157
we will not execute for the we will return back to the from the to the front end
158
that we don't have any if we don't get the API key with your request
159
so it's an invalid request API key is missing
160
or invalid okay okay
161
so we the short answer is we will use the app dot use method
162
and next method to to handle
163
this situation whether we have a we have to proceed with the request there is a valid API key
164
if there is a valid API key then yes awaited up next will execute this this map controllers
165
last line of code okay and if there is no api key then it's written just written it blank okay
166
this code is executing
167
and getting all the customers from the database okay this dot customers from the database
168
and then assigning this customer details to a list this now customer variable is a list
169
which will have all the list of the customers okay then we are iterating the customers list one by one
170
and getting the orders of the customers each customer okay and so that is the code now
171
you have to tell me we is there any problem with this code
172
or is we can can we make this better
173
can we optimize this is there anything you have noticed like
174
so this is an example of eager loading
175
so we are just iterating one by one and it is increasing the round trip with the database
176
and to avoid these with it is a good because
177
if we are not more than more rows in the database
178
but if we have a five likes to two lakhs rows in the database it is not a good
179
because it will increase the latency and roundtrip, it can increase.
180
Instead of we can use explicit loading, so we can use the include keyword and get the data.
181
And we can get the particular data, whatever that we want to need.
182
We can use the include keyword and these iteration will need to remove.
183
One by the iteration we need to remove.
184
Yeah, so correct.
185
Your answer is correct correct so basically uh i'm just elaborating
186
or i'm just rephrasing what you have said
187
so what is happening here is first we are making one this query
188
and getting a query hitting the database so this is one
189
and suppose we get 100 customers in this list
190
then for 100 each of those customers we are making one query for each customer
191
so it's like 100 queries again we are making
192
so total we have this 100 plus 1
193
which is 100 plus 1 1 0 1 database hits
194
so this is also called n plus 1 problem okay
195
so the solution is again what you have said and
196
that is we have to use the include method okay and include method will get the customer and order details
197
like this you do not with only a single head to the database okay
198
so this is one way and we call it
199
equal loading this only okay another approach is using the select method
200
this is the select method now forget about this code uh
201
you can forget like uh yeah control z let just forget about this code here ctrl x
202
so this is the select method that we also called projection
203
the benefit of select over include is in select
204
you can give the sorry control z give the columns specific columns
205
which you want okay with include you have to have get all you will get all the columns by default
206
but with select you can give the columns also like this id name
207
and inside order what you want order id order i getting my mind yes yes okay so
208
that is the difference
209
and there is the these are the co-options okay are you an experienced dotnet developer
210
but struggling to clear interviews knowing definition is not enough
211
answering scenario based questions can decide your selection in my free live.net interview workshop
212
i will explain how to prepare for interviews
213
if you are preparing for your next.net interview
214
then this workshop is for you register for free workshop on 6 september sunday 8 pm
215
using the link in the description we'll see you live in your application you have a controller and that contains validation code,
216
that contains business logic methods, that contains properties, that also contains database code.
217
So how you will refactor your application, how you will refactor that controller to make it better?
218
So firstly, I will divide my application, my controller into the layers,
219
like repository and service and interface and business logic should be different and database logics should be different.
220
Means I will use a repository pattern to divide the application into the layers.
221
Like my business logic will be in the services and database,
222
data DB context means the database things will be in the repository.
223
Yes, so basically we have to divide the things we should not keep like single responsibility principle uh solid
224
or principle single responsibility so one controller or any file class file
225
or any should not can be responsible for multiple things single responsibility controller should only receive the request
226
and return the http response
227
then from there there will be domains dto's for your properties entities different class for them
228
which will be responsible for property then validation for validation you should have a different data annotation
229
or different model fluent validation then there will be service layer for the business logic then yes
230
that access layer or you can say the repository
231
layer also you can say it for entity framework or ado.net
232
so if you will add like single responsibility thing to these kinds of you can relate able to relate then
233
that will be sound good but yeah that is also the same thing you are saying okay

Download App

Everything you need to speak fluently

AI PronunciationScore every sentence
IPA PracticeMaster every sound
VocabularyBuild your word bank
Vocab GameLearn while playing
FOR YOU

Recommend Video

Vocabulary and speaking notes for this lesson

This speaking lesson is built on the video “.NET Mock Interview - Scenario Based - 7+ Years Experienced Candidate”. The speaker keeps coming back to these words: user, request, method, application, controller. This video has 233 sentences and 2805 words to shadow. The speech runs for 20:13. The speaker talks at a steady 139 words per minute, a comfortable pace for shadowing. 86% of the words are among the 3,000 most common in English; the rest is worth studying before you start.

Key vocabulary in this video

15 words from the video worth learning, with pronunciation and meaning:

WordPronunciationMeaning
thread noun/ˈθɹɛd/A cord formed by spinning or twisting together textile fibers or filaments into one or more continuous strands, typically used in needlework.
database noun/ˈdeɪtəˌbeɪs/A collection of (usually) organized information in a regular structure, usually but not necessarily in a machine-readable format accessible by a computer.
controller noun/kənˈtɹoʊlɚ/One who controls something.
interface noun/ˈɪn(t)ɚˌfeɪs/The point of interconnection or contact between entities.
execute verb/ˈɛksɪˌkjuːt/To kill, especially as punishment for a capital crime.
await verb/əˈweɪt/To wait for.
select verb/sɪˈlɛkt/To choose one or more elements of a set, especially a set of options.
scope noun/skəʊp/The breadth, depth or reach of a subject; the extent of applicability or relevance; a domain, purview or remit.
implement verb/ˈɪmpləmənt/To bring about; to put into practice; to carry out.
workshop noun/ˈwɝk.ʃɑp/A room, especially one which is not particularly large, used for manufacturing or other light industrial work.
token noun/ˈtoʊkən/Something serving as an expression of something else.
layer noun/ˈleɪ̯ɚ/A single thickness of some material covering a surface.
lifetime noun/ˈlaɪf.taɪm/The duration of the life of someone or something.
valid adjective/ˈvælɪd/Well-grounded or justifiable, pertinent.
log noun/lɔɡ/The trunk of a dead tree, cleared of branches.

Phrasal verbs you will hear

WordMeaning
go back to verbTo stem from; to originate in.

Sentences worth repeating

Short, complete lines from the video that you can reuse in everyday conversation:

  • Can you tell me is there any problem?
  • Can you improve this code?
  • Do you think it is?
  • I'm telling you because I asked the steps.

Grammar in this video

The structures the speaker uses most, with the exact words from the video:

StructureIn the video
Conditional sentences if + clause, will/would + verb — a condition and its resultif the thread will block · If other user will logged
Passive voice be + past participle — the focus is on what happens, not who does itwill be blocked · will be released · will be allowed
Present perfect have/has + past participle — a past action that still matters nowhave already written · have said · has received
Relative clauses who / which + clause — extra information about a person or thingservice which will · points which were

Pronunciation to watch

The speaker uses 13 contractions and reduced forms, such as don't, I'm, we'll. Say them the short way, as you hear them.

  • The “th” sounds: thread /ˈθɹɛd/, smoothly /ˈsmuːðli/, authentication /ɔːˌθɛntɪˈkeɪʃn̩/
  • The “sh” and “zh” sounds: workshop /ˈwɝk.ʃɑp/, validation /ˌvæl.əˈdeɪ.ʃən/, injection /ɪnˈd͡ʒɛk.ʃən/, detection /dɪˈtɛk.ʃən/, indication /ɪndɪˈkeɪʃən/
  • Long words — get the stress right: validation /ˌvæl.əˈdeɪ.ʃən/, dependency /dɪˈpɛndənsi/, developer /dɪˈvɛləpɚ/, entity /ˈɛn.tə.ti/ [-tʰi], elaborate /ɪˈlæb.ə.ɹeɪt/

How to practise with this video

  1. Listen to the whole video once without speaking and note the words you do not know.
  2. Shadow it sentence by sentence at normal speed, repeating each one until your rhythm matches the speaker.
  3. Record yourself and compare with the original, paying attention to words like thread, database, controller.

What is the Shadowing Technique?

Shadowing is a science-backed language learning technique originally developed for professional interpreter training and popularized by polyglot Dr. Alexander Arguelles. The method is simple but powerful: you listen to native English audio and immediately repeat it out loud — like a shadow following the speaker with just a 1–2 second delay. Unlike passive listening or grammar drills, shadowing forces your brain and mouth muscles to simultaneously process and reproduce real speech patterns. Research shows it significantly improves pronunciation accuracy, intonation, rhythm, connected speech, listening comprehension, and speaking fluency — making it one of the most effective methods for IELTS Speaking preparation and real-world English communication.

Shadowing technique: read the full step-by-step guide →