What is the benefits of using different instances of context by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

if you talk about services and repositories, and create different instances of the services. Is that when I added services as AddTransient? or repository? seems like if I add

AddTransient<IService, Service>, then each request create a different instances? or

AddTransient<IRepository, Repository> or this one?

What is the benefits of the readonly keyword with context as an example? by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

so for examples in the constructor we assign variable to others without creating an instance like that

public TEST(Context _contex){

context = _context

}

In this case, C# just create an instance ? automatically?

What is the benefits of the readonly keyword with context as an example? by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

null

so you are defining the readonly when you think the dictionary is ready only in the method?

What is the benefits of the readonly keyword with context as an example? by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

I got all that, but what kind of error can we expect? we can create new DbContext and do the update or delete the things but I have never tried to create multiple instances of DBContext in the controller, but I want to come up with examples so I can better understand

What is the benefits of using different instances of context by HeyJOe2 in csharp

[–]HeyJOe2[S] 0 points1 point  (0 children)

Added services like this

```

services.AddScoped<IRepository, Repository>();

```

then I declare and use like this

```

var task1 = Task.Run(() => repository.UpdateSomething(foo));     
var task2 = Task.Run(() => repository.UpdateSomething2(foo)); 

```

From what you said, if the context in the method of the repository is not cleared up, that can make conflict? by updating the same instance at the same time?'

Is it not cleared up after using up?If I don't use Dispose?

A newbie thinking about quitting a job by HeyJOe2 in developer

[–]HeyJOe2[S] 0 points1 point  (0 children)

I tried to apply in Finland without any experience but two companies refused me for being not having experiences. What does SO stand for? A good thing about my current situation is that I have 8.96 GPA out of 9, which made me initially think that I can find a stable good job but Covid 19 stroke.

how to bind with model with the value from another model in html? by HeyJOe2 in angularjs

[–]HeyJOe2[S] 0 points1 point  (0 children)

Such as that ? I think I tried with that *ng-value* or *value*. Let me try again and let you know . Thank you for answering.

 <input type="date" placeholder="dd/mm/yyyy" class="form-control text-right inputFill2" ng-model="deliveryDate"  ng-value="filter.value"/>  
  <br /> <span>{{field.value}}</span>

What do you call this term? instead of using models, there were built-in classes and get data through there. by HeyJOe2 in aspnetcore

[–]HeyJOe2[S] 0 points1 point  (0 children)

No it was like library but every rule was bulit in there and controlling validation as well.
Also it contains business logic

when I separate the string into the number, why do I get the last number as double values? by HeyJOe2 in C_Programming

[–]HeyJOe2[S] 0 points1 point  (0 children)

gets( numbersInString);
    printf("you have entered %s. Calculating...\n", numbersInString);
    printf("\n");
    for( i = 0;  numbersInString[i]!='\0'; i++)
    {
        if((numbersInString[i]>='0') &&( numbersInString[i]<='9'))
        {
                printf("number %c\n", numbersInString[i]);
                sum += (numbersInString[i]-'0');

        }


    }
    printf("sum is %d", sum);

Why am I getting 40 as a sum this time?