« first day (3550 days earlier)      last day (1381 days later) » 

mr5
7:37 AM
Glad to know some big time personality from China are standing up against CCP: dailymail.co.uk/news/article-8391687/…
That website has a lot of ads. Beware!
 
 
3 hours later…
11:37 AM
@CaptainObvious this actually useless, but fancy
 
I just got surprised knowing that the second Child does not necessarily need to specify Parent.


class Parent { }
partial class Child : Parent { }
partial class Child : Parent
{
static void Main()
{
Console.WriteLine("test");
}
}
is the same as


class Parent { }
partial class Child : Parent { }
partial class Child
{
static void Main()
{
Console.WriteLine("test");
}
}
Is it a miracle?
Piing me if you want to give some comments. I am leaving for a couple of minutes.
 
it would be annoying to have to explicitly mention that each individual partial class implements or extends the parent
if the compiler would throw an error for that, the compiler appears to know that the other partial class is missing the implements/extends mention of the parent
if the compiler knows what the code means and you can clearly see what the code means, the compiler shouldnt throw an error
examples of where the compiler would know what we mean, but we still need to tell it explicitly that it indeed is what we want
IList<String> list = new List<String>(); (shouldnt need to tell it is about strings twice)
public static void Foo(this Object self) {} (shouldnt necessarily be in a static, non-nested class)
 
11:53 AM
Without my glass I can't C#
 
 
3 hours later…
2:55 PM
The last message was posted 3 centuries ago.
Hi folks, I noticed Razor component cannot have constructor injection, is it by design?
 
@TooFatManNoNeck Do you mean dependency injection?
 
Yes.
@CaptainObvious: yes.
 
@CaptainObvious yes.
(just in case you missed the message)
 
Hmm, are you sure? Have you tried tdoing @inject IService service at the top of you .razor?
 
@CaptainObvious using @inject is not constructor injection I think but property injection
@inject is always fine.
 
3:07 PM
no @inject is dependency in razor files
because they don't really have proper ctors as such
 
public partial class Index
{
private readonly IRepository<Movie> repository;
public Index(IRepository<Movie> repository)
{
this.repository = repository;
}

}
does not work
 
What are you doing
That's not how it works in blazor
 
    public partial class Index
    {
        // I don't know why ctor injection does not work!
        //private readonly IRepository<Movie> repository;
        //public Index(IRepository<Movie> repository)
        //{
        //    this.repository = repository;
        //}

        [Inject] public IRepository<Movie> repository { get; set; }

        private IList<Movie> movies;

        protected override async Task OnInitializedAsync()
        {
            await Task.Delay(3000);

            movies = repository.GetItems();
It might be by design feature.
 
Where are your UI tags?
 
@page "/"


<MovieList Movies=movies Deleting=OnDeleting />
I moved all contents of @code{} to a code behind file in the form of a partial class.
And it is legal.
 
3:12 PM
wtf
What version of .net core are you using?
 
3.1
or might be 3.2 I will check
3.1.301
 
Did it work before moving the code into a partial?
 
constructor injection ? I will check again
 
Oh wait
Yeha no the code you were trying to do isn't valid
If you want to inject when using a partial you have to use the [inject] attribute
 
@inject always works, it is not my question.
ctor injection never works either in @code{} or partial class (code behind).
 
3:20 PM
That's because it's razor
Protip
Stop calling it constructor injection because 1) it's called dependency injection and 2) it makes you think it works differently than it does
Razor pages and components don't use DI in the same way as other things
They get their dependency injected as a field in the scope of the page itself
 
there is constructor based dependency injection tho... as opposed to property based dependency injection
 
@Wietlol: You are correct!
 
obviously :D
 
@Wietlol [citation needed]
It's not a thing in razor
 
I prefer to use constructor based DI, but if it is impossible due to how some random framework works, then property based DI should do fine
 
3:25 PM
Can you use ctor DI with your page model with razor
But not with the page itself
you can*
 
 
2 hours later…
5:58 PM
o/
 
Hi Bakker, how are you? Haven't seen you for a while
 
6:16 PM
Hey bro, I'm alright but at the final stages of my studies
Things are still kidna hectic for me, long stories which I'll tell later soon someday
How are you doing Alex?
 
6:33 PM
hi! I am having a problem with the C# extension in VS Code, anyone able to help (not really worth a whole question's effort)?
there are errors in the Razor log and nothing is working about the C# extension (but the other logs seem fine)
> F1 -> Open Settings(JSON)
Find the "[csharp]" key
Set the value of "editor.defaultFormatter" to "ms-dotnettools.csharp"
there is not anything labeled "csharp" anywhere and I don't know what I would do to add it is the problem (I don't know what a JSON key is exactly)
The whole contents of the settings JSON are
> {
"omnisharp.path": "latest"
}
 
7:24 PM
actually I think there um...might not have been a problem lol
good day
 
8:12 PM
Always good when you figure it out
 

« first day (3550 days earlier)      last day (1381 days later) »