Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Michał Zegan
    @webczat
    also about os being better at this, not sure. I imagine a need to have isolated/untrusted parts of app, externally loaded, mostly scripts in other languages.
    TeBeCo
    @tebeco
    That’s one way
    Also mean that you get another layer of abstraction, so other possible vector
    Michał Zegan
    @webczat
    I even have a pretty old and almost irrelevant use case but these things still do exist and are even managed. mud type games :D where people creating them don't have permissions to mess up everything with the code.
    TeBeCo
    @tebeco
    Not sure the status today
    TeBeCo
    @tebeco

    Here is an article from 2004 with file access
    https://www.codeproject.com/Articles/5724/Understanding-NET-Code-Access-Security

    Fun part

    Warning from Microsoft!: If asserts are not handled carefully it may lead into luring attacks where malicious code can call our code through trusted code.

    I wish I found more article with details of what was removed and what was kept

    Also as AppDomain disappeared in .NetCore well ...

    Michał Zegan
    @webczat
    remoting was removed
    cas was removed, but some classes/attributes/etc remained for compat. and actually it is very much confusing, because they are not marked obsolete, deprecated, for compat, no. because why :D
    even at dotnet framework doc you have them described even though cas is probably deprecated for a long time, probably since 3.5?
    Will 保哥
    @doggy8088
    The code solved my question. Just change File() to PhysicalFile(), but I still don't know what thevirtualPath mean!
    public IActionResult GetCourseForPic()
    {
        var fileName = Path.Combine(
            hostingEnvironment.ContentRootPath, 
            "2019-12-06_23-13-54.jpg");
    
        return PhysicalFile(fileName, "image/jpeg");
    }
    Will 保哥
    @doggy8088
    I finally realized all the details. It's called File Providers. By default, it's _hostingEnvironment.WebRootFileProvider. 😄 👍
    carlos26102
    @carlos26102
    Hi, I'm new at his one, How can I install dotnet-install.ps1 on windows cmd?
    Too I want to install Microsoft.EntityFrameworkCore.SqlServer and I can't
    do you know any good guide to create webapi with net core 3.1?
    Michał Zegan
    @webczat
    I realized kestrel can do unix domain sockets... question is, what is the best practice or how do you do things like chmodding/chowning them? othervise this is not very useful if I want to attach it to nginx :P
    Michał Zegan
    @webczat
    well useful, but it would be a manual or manually added step. hmm
    TeBeCo
    @tebeco
    Ask on aspnet/aspnetcore repo or dotnet/runtime (I wonder if Unix socket is in BCL or not)
    Michał Zegan
    @webczat
    it is
    TeBeCo
    @tebeco
    @carlos26102 wooo your question have typo I guess
    It seems you are too much confused about lots of unrelated thing
    Michał Zegan
    @webczat
    interesting. seems to me like aspnetcore may be sometimes faster than nginx...? like was doing some completely unprofessional benchmarking using ab. like nginx static files vs aspnetcore static files, nginx was twice as fast, until i enabled keepalive then actually aspnetcore was a bit but considerably faster. :D it surprises me
    the setup was UseStaticFiles, index.html in webroot with simple content, same content and file served over nginx. no tls on both.
    and 4 concurrent requests
    but if concurrency of requests set to 1 then nginx is again faster. maybe my nginx is not well configured :P but in any case I never expected that
    carlos26102
    @carlos26102
    please, anyone can tell me how make dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 3.1.0
    works, because tells me not found
    carlos26102
    @carlos26102
    k
    every package try to add tells me can't find it
    image.png
    image.png
    TeBeCo
    @tebeco
    Remove the version when you add a package
    carlos26102
    @carlos26102
    still persist problem
    image.png
    TeBeCo
    @tebeco
    Your app is named TodoApi 2.1
    Are your targeting netcoreapp2.1 by any chance ?
    Also what’s the nuget uri you are using in your nuget config
    The url I see looks like nugetV2 instead of v3 but I maybe wrong
    Yuant-tobing
    @Yuant-tobing
    is it possible to make a preload blazor (ss) component?
    Let's say! we only want to load components that are already in the viewport. I think it would be better to load the website faster, even if it is possible to cache components into redis or something similar. Do any of you have the experience to do it.?
    TeBeCo
    @tebeco
    Like something called “server side Blazor” ?
    Yuant-tobing
    @Yuant-tobing
    Yes, but the Blazor still uses memory cache and cann't initialize the viewport page yet. Do you have experience with this?
    TeBeCo
    @tebeco
    Create an issue on the repo and ask them then ;)
    Yuant-tobing
    @Yuant-tobing
    Yeah, I plan to make a PR, but I don't know where to start first. I just find my website appears rigid in every action and I need a solution for that. :(
    Ajay Kumar
    @ajayak
    Hi, I'm trying to take max value from each group in ef core 3.0 which used to work previously. Can someone help? :)
    Sample Query:
    await _context.Actions
                  .GroupBy(a => a.ParentId)
                  .Select(s => s.OrderByDescending(a => a.Version).First())
                  .ToListAsync();
    Michał Zegan
    @webczat
    hi. any clue (just curious) why EF has DbContext but metadata like model is cached internally, instead of having something like DbContextFactory where I would explicitly cause metadata load and then clear metadata by disposing this factory at end of app? just for compat with EF non core, or because of other reasons?
    dimtabu
    @taburetkin

    i am faced with some strange behavior in core2.2 EF

    public class Something
    {
      public Guid Id { g;s; }
      public virtual ICollection<SomethingElse> Things { g;s; }
    }
    public class SomethingElse
    {
      public Guid Id { g;s; }
      public Guid SomethingId {g;s;}
      public virtual Something Something {g;s;}
    }

    and here is select statements

    db.Set<Something>().Select(ext => new {
      id = ext.Id,
      things = ext.Things.Select(ext2 => new { id = ext2.Id })
    }).ToList();

    this will work pretty well.
    Entellisense says that ext.Things.Select is a Enumerable.Select(IEnumerable<TIn> query, Func<TIn, TOut> selector)
    but if i will do it like this:

    public class SomethingElseDto
    {
      public Guid Id {g;s;}
    }
    
    Func<SomethingElse, SomethingElseDto> selector = ext2 => new SomethingElseDto { id = ext2.Id }
    
    db.Set<Something>().Select(ext => new {
      id = ext.Id,
      things = ext.Things.Select(selector)
    }).ToList();

    i will get an exception:

    Could not parse expression 'ext.Things.Select(__selector_1)': The given arguments did not match the expected arguments: Object of type 'System.Linq.Expressions.TypedParameterExpression' cannot be converted to type 'System.Linq.Expressions.LambdaExpression'.

    Can someone shed light on this? what am i missing?

    CodingTank Limited
    @CodingTankLtd_twitter
    I think selector needs to be Expression<Func<SomethingElse, SomethingEsleDto>>
    Martijn Hoekstra
    @martijnhoekstra
    Just writing the signature of selector like that should be enough
    anthalon
    @anthalon

    I am trying to create a HttpRequestMessage by copying data from HttpContext in a middleware:

    var streamContent = new StreamContent(context.Request.Body);
    requestMessage.Content = streamContent;
    
    foreach (var header in context.Request.Headers)
    {
        requestMessage.Content?.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
    }

    and then I send the content using SendAsync

    responseMessage = await _httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, context.RequestAborted);

    which works. The issue is passing the context.User
    How can I forward the User data to the target?

    ** Using Windows Authentication

    dimtabu
    @taburetkin
    I did not check sources yet, but i feel that there is something special under the hood
    ICollection<> implements IEnumerable<>
    Enumerable.Select expects Func<TSource, TDestination> or Func<TSource, int, TDestination>
    It seems that Linq does something with this, probably convert it to IQueryable and does all the stuff.
    The things became complicated when you build expression tree by yourself and at this point those cases should be catched and resolved.
    when you do it like in my example its not so difficult.
    @CodingTankLtd_twitter ^
    Michał Zegan
    @webczat
    isn't the context.User something that is related to some http feature in FeatureCollection?