Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 07 13:24
    clairernovotny unassigned #7
  • May 07 13:24
    BillWagner added as member
  • May 07 13:24
    BillWagner removed as member
  • May 07 13:22
    clairernovotny closed #182
  • May 07 13:22
    clairernovotny commented #182
  • May 07 13:21
    clairernovotny closed #192
  • May 07 13:21
    clairernovotny commented #192
  • May 04 08:11
    MarcoRossignoli opened #192
  • Apr 30 15:40
    NextTurn closed #154
  • Apr 30 02:54
    NextTurn commented #191
  • Apr 29 15:53

    clairernovotny on master

    Fix broken links Split from dot… Merge pull request #191 from Ne… (compare)

  • Apr 29 15:53
    clairernovotny closed #191
  • Apr 29 15:53
    clairernovotny commented #191
  • Apr 29 15:39
    NextTurn opened #191
  • Apr 29 14:06

    clairernovotny on master

    Fix broken links Split from #154 Merge pull request #190 from Ne… (compare)

  • Apr 29 14:06
    clairernovotny closed #190
  • Apr 29 14:06

    clairernovotny on master

    Fix broken links Split from #154 Merge pull request #189 from Ne… (compare)

  • Apr 29 14:06
    clairernovotny closed #189
  • Apr 16 15:55
    NextTurn opened #190
  • Apr 15 15:55
    NextTurn opened #189
TeBeCo
@tebeco
probably on both discord server
"c#" and "dotnet evolution"
Panos Athanasiou
@panoukos41

Ef-core related question. Is it possible to have one to many relationships for multiple objects?
I have an object NodeGroup that has it's own name id etc. Objects that define the interface INodeGrouped have a property NodeGroupId.
I have two different objects implement this interface, and a list in NodeGroup'List<INodeGrouped> Nodes`.
Will this relationship work?

builder.HasMany<INode>(x => x.Nodes)
    .WithOne(x => x.NodeGroup!)
    .HasForeignKey(x => x.NodeGroupId);

Somthing like this!

Darren R. Starr
@darrenstarr

Not sure where else to ask, but I'm trying to make a LINQ statement that operates on an IEnumerable<> that should take 3 values from the list at a time and create a new object from each into a new enumerable. The code I have which works is:

var pathSegmentCollection1 = new PathSegmentCollection();
for (var i = 1; i < ScaledCurve.Count; i += 3)
{
    pathSegmentCollection1.Add(new BezierSegment
    {
        Point1 = ScaledCurve[i],
        Point2 = ScaledCurve[i + 1],
        Point3 = ScaledCurve[i + 2]
    });
}

Where ScaledCurve is Windows.UI.Xaml.Media.PointCollection

Is there a way where I can

ScaledCurve.Skip(1).Select(... new BezierSegment from 3 values...)
Stephen A. Imhoff
@Clockwork-Muse
@darrenstarr - You're looking for some sort of Chunk operation, which isn't present in the base libraries (there's at least one proposal). I believe there's third-party libraries that already do, however.
Darren R. Starr
@darrenstarr
@Clockwork-Muse Thanks, that's what I was looking for. I hope it shows up someday :)
Daniel Hughes
@trampster
Where can I find the source code for StringBuilder
TeBeCo
@tebeco
dotnet/runtime
Jason Priddy
@BatmanPriddy
Daniel Hughes
@trampster
thanks
Jason Priddy
@BatmanPriddy
Anytime, that's a great site for .NET source code!
Hugh Gleaves
@Korporal
@darrenstarr - This extension method should do what you need:
public static class Extensions
{
    public static IEnumerable<IEnumerable<T>> Pack<T>(this IEnumerable<T> S, int X)
    {
        int Y = 0;

        while (S.Skip(Y).Any())
        {
            yield return S.Skip(Y).Take(X);
            Y = Y + X;
        }
    }
}
This is kind of how you'd approach the solution in F#.
Hugh Gleaves
@Korporal
Or if you prefer a bit more compact
public static class Extensions
{
    public static IEnumerable<IEnumerable<T>> Pack<T>(this IEnumerable<T> S, int X)
    {
        int Y = 0;

        do  
        {
            yield return S.Skip(Y).Take(X);
        } while (S.Skip(Y+=X).Any());
    }
}
image.png
Hugh Gleaves
@Korporal
Also if you make your BezierSegment class expose a constructor that takes an IEnumerable, perhaps throwing if it doesnt have exactly three elements, then you can code this:
        var segments = ints.Pack(3).Select(triple => new BezierSegment(triple));
Hugh Gleaves
@Korporal
If you prefer recursion as opposed to mutable counters:
    public static IEnumerable<IEnumerable<T>> PackBy<T>(this IEnumerable<T> S, int X)
    {
        if (S.Any() == false)
            yield break;

        yield return S.Take(X);

        foreach (var sub in S.Skip(X).PackBy(X))
            yield return sub;
    }
Khizar Iqbal
@EngrKhizarIqbal
Hi Anyone here?
Hugh Gleaves
@Korporal
I am
Khizar Iqbal
@EngrKhizarIqbal
Does anyone guide me on how to run multiple tasks in asp.net core background service using queue background service implementation modal?
TeBeCo
@tebeco
there's a dedicated session in the docs avec background section with this as an exemple IIRC
with semaphore / loop queue / dequeue / consumer etc....
Khizar Iqbal
@EngrKhizarIqbal
Oisin Grehan
@oising
@EngrKhizarIqbal You need to be more specific. Do you mean running (and waiting on) multiple paralllel tasks in a hosted service (backgroundservice/ihostedservice), or do you mean multiple hosted services? You need to describe your problem clearly, please.
Khizar Iqbal
@EngrKhizarIqbal
@oising Sorry for not clearly describing my problem. I have a service that uploads files to multiple cloud storages (one file can be uploaded to one or more cloud storage depends upon the user's preferences). Currently, my background service is working, it getting items from IBackgroundTaskQueue and uploading it however it process one file at a time but what I wanted is to process/upload multiple files at the same time. I'm using resumeable/chunk based model to upload files.
What I've done is returning list of work items from the IBackgroundTaskQueue DeQueue method and then start a task for each item in Background service. however, I don't know if this is a good implementation or there could be any better way of doing this.
Panos Athanasiou
@panoukos41
Hey all, is it possible to get a null value when the provided json in JsonConvert.Deserialize<T>() can't be mapped to the T ?
TeBeCo
@tebeco
what happen when you give valid json but not matching any public properties ?
i never tested that
or just {} from the json
I would have that that if the ctor is a public default one then an instance is created
but all field are default
Panos Athanasiou
@panoukos41
Indeed no matter what json you get if a value was found (depending on settings) it will be set otherwise it is default.
I ended up, for now, to get the json, deserialize it validate the values, and then serialize it again to be sure I got the valid values and nothing extra.
The next step would be to check if the properties exist using JSON documents.
Another step I considered is a custom converter for the class and if I don't find the exact properties just return null. This seems like a more viable option and easier in the future since it works on the json at deserialization.
Yousif Touma
@yousiftouma
is there some channel appropriate for efcore questions?
Dangelo
@dangelogonzalezquezada
I do not think so Yousif.
Do you know how can I share methods from different controllers? I am a newbie, and do not want to use repository pattern, but a simple way to share methods...
Dangelo
@dangelogonzalezquezada
I am using asp.net core 3.1 mvc
Scott Michaud
@ScottMichaud
So for "share methods"... all programming is functions with parameters and a return value. C# doesn't have first-class functions... so you have two choices: a static method and an instance method. An instance method is like a static method, except that it has one extra, hidden parameter called "this".
When you want to call a function, you need access to the object instance that you want to run the method on. If it's an instance method, then it will be memoryAddress.myMethod(parameters).
If you're in the same class, then you have access to everything private, protected, and public. If you're in a different class, then you only have access to public. (unless it's a child, and there's some "internal" crap too but I'm cutting it out for simplicity.)
So any public method can be accessed by anything else that has its memory address.
That's half the problem.
The other half is "how do you know where in memory something will be"... and that depends.