.tree
.tree
CC#
Created by .tree on 9/7/2023 in #help
❔ XAML nested View, Parent is null?
Yes I see now how my question was terrible, however I have solved my issue so thank you for pointing out how I could have provided more information :)
11 replies
CC#
Created by .tree on 9/7/2023 in #help
❔ XAML nested View, Parent is null?
What kind of context would be needed? I have a View inside which I call another view (the content of one of two tabs that I switch between). Meanwhile the outer view is visible the entire time
11 replies
CC#
Created by .tree on 8/28/2023 in #help
❔ XAML accessing property of parent views element
Ok I was under the impression it would find the node I specified automatically. I didnt consider that I might have to specify the grid2 as well
8 replies
CC#
Created by .tree on 8/15/2023 in #help
❔ Xamarin XAML - Contents of grid inside TabViewItem not visible
Apparently I need to put the contents into <xct:TabViewItem.Content>, but that didnt help either
3 replies
CC#
Created by .tree on 8/8/2023 in #help
❔ Access a DB property from a not mapped property
EF Core is used to access sqlite db, we use lazy loading because what our data models is only usefull in its entirety
19 replies
CC#
Created by .tree on 8/8/2023 in #help
❔ Access a DB property from a not mapped property
Yeah so that is the issue I think, those are self written methods for lazy loading: protected virtual T Get<T>(ref T backingField, [CallerMemberName] string name = null) where T : LazyLoaderModel {
19 replies
CC#
Created by .tree on 8/8/2023 in #help
❔ Access a DB property from a not mapped property
Just realized I totally messed up the question. Class A has this property [ForeignKey("ArticleID")] public ArticleModel Foo { get => Get(ref article); set => Set(value, ref article); } private ArticleModel article = null; Which references this property in class B: [ForeignKey("KindID")] public KindModel Bar { get => Get(ref kind); set => Set(value, ref kind); } private KindModel kind = null; Now in class A I want another property of type KindModel that stores the value of Bar, which is the same type.
19 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
Its really not that hard once you think about it a little, thank you for your help!
31 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
Yeah makes sense. So the DoAddNumbers in my inheriting class has to be protected now since the abstract method in my abstract class is protected too. So it looks like this now:
c#
public abstract class GeodatabaseAbstract : IGeodatabase
{
protected abstract int DoAddNumbers(int a, int b);

public int AddNumbers(int a, int b)
{
CommonCode();
return DoAddNumbers(a, b);
}
private void CommonCode()
{
// Common code for all DBs
Console.WriteLine("Yeah boi");
}
}
c#
public abstract class GeodatabaseAbstract : IGeodatabase
{
protected abstract int DoAddNumbers(int a, int b);

public int AddNumbers(int a, int b)
{
CommonCode();
return DoAddNumbers(a, b);
}
private void CommonCode()
{
// Common code for all DBs
Console.WriteLine("Yeah boi");
}
}
c#
public class GeodatabaseArcObjects : GeodatabaseAbstract
{
protected override int DoAddNumbers(int a, int b)
{
int c = a + b;
return c;
}
}
c#
public class GeodatabaseArcObjects : GeodatabaseAbstract
{
protected override int DoAddNumbers(int a, int b)
{
int c = a + b;
return c;
}
}
Now when I call it like this:
c#
IGeodatabase geodatabaseAccess = new GeodatabaseArcObjects();
Console.WriteLine(geodatabaseAccess.AddNumbers(1,2));
c#
IGeodatabase geodatabaseAccess = new GeodatabaseArcObjects();
Console.WriteLine(geodatabaseAccess.AddNumbers(1,2));
It uses the public AddNumbers from my abstract, does the common code, then it calls DoAddNumbers which is abstract, so it uses the specific implementation it has itself?
31 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
What should AddNumbers be? Protected? The issue with that is that the Interface complains, since it defines AddNumbers and wants it to be public
31 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
So in my example
c#
public abstract class GeodatabaseAbstract {
public abstract int AddNumbers(int a, int b);

protected void DoAddNumbers(int a, int b) {
CommonCode();
AddNumbers(a, b);
}

private void CommonCode() {
// common code
}
}
c#
public abstract class GeodatabaseAbstract {
public abstract int AddNumbers(int a, int b);

protected void DoAddNumbers(int a, int b) {
CommonCode();
AddNumbers(a, b);
}

private void CommonCode() {
// common code
}
}
The inheriting class would be
c#
public class GeodatabaseArcObjects : GeodatabaseAbstract {
public override int AddNumbers(int a, int b) {
int c = a + b;
return c;
}
}
c#
public class GeodatabaseArcObjects : GeodatabaseAbstract {
public override int AddNumbers(int a, int b) {
int c = a + b;
return c;
}
}
Where would I call DoAddNumbers now? My ArcObjects specific implementation of AddNumbers still needs to be there, but how do I tell it to do common code and then the specifig AddNumbers?
31 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
But when I do it like this, what would my inheriting class look like? Do I override the abstract method and call DoStuff() inside it?
31 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
No, my issue was this: If I have an abstract method in my abstract class AddNumbers, there is some code that I want each of my inheriting classes to do when they execute AddNumbers. Since it's abstract I cant put that code into the method itself, so I tried to define the common code in its own method and write a wrapper like "AddnumbersWrapper" that calls the common code method and the abstract method
31 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
What exactly do you mean by expose? Just to call them in methods of my inheriting class?
31 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
Sorry, this should be the correct code: https://paste.mod.gg/jiooicbvytsm/0
31 replies
CC#
Created by .tree on 3/20/2023 in #help
❔ Circular dependency between projects
That seems to work for now. I will read up a bit on the matter, I don't think I really understand what I'm doing and why
117 replies
CC#
Created by .tree on 3/20/2023 in #help
❔ Circular dependency between projects
Ok then I'm confused
117 replies
CC#
Created by .tree on 3/20/2023 in #help
❔ Circular dependency between projects
But if it doesn't get one it's just null
117 replies
CC#
Created by .tree on 3/20/2023 in #help
❔ Circular dependency between projects
So the issue is that it needs an instance for registration?
117 replies
CC#
Created by .tree on 3/20/2023 in #help
❔ Circular dependency between projects
Registration is this line correct services.AddSingleton<IGeodatabase>(GeodatabaseService.GeodatabaseAccess);
117 replies