zuzaki
zuzaki
CC#
Created by Gustavo Cruz on 7/16/2024 in #help
Overkill on the use of interfaces for Dependency Injection in Web APIs?
Thanks that helps. I'm thinking of pros and cons. With your rules it seems like a fine way to code, but I would except that some problems can arise. Static classes are not garbage collected, so would there be potential for memory leaks? I think you need to be very disciplined in your design to not introduce state, or too much, into the static classes. And the api or class design is something I see being skipped in a lot of projects.
15 replies
CC#
Created by Gustavo Cruz on 7/16/2024 in #help
Overkill on the use of interfaces for Dependency Injection in Web APIs?
Pixel, can you show a real example because I don't think I understand your infograph. I'm currently working in a code base with a lot of static classes and my impression is that it's very hard to follow code flow, since it jumps around a lot, and it's very hard to test services when it uses 3 or more different static classes. I can't really figure out of it's due to bad class design or if it's all the static classes or both.
15 replies
CC#
Created by RXPHXEL on 7/8/2024 in #help
✅ In Identity Model class i am having CS1729 coded error message.
You need to either register the DbContext as a service or override OnConfiguring. Take a look at the documentation here: https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=visual-studio
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
or
builder.Services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("SchoolContext")));
builder.Services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("SchoolContext")));
25 replies
TTCTheo's Typesafe Cult
Created by i.am.the.honored.one on 1/21/2024 in #questions
Seeking a career/life advice.
It sound to me that you have been focused so much on one thing, which lead to neglect of other areas. Now you succeded, but as it is for most, the end destination of a goal is often not a place where happyniess is. Often it leads to lack of goal, feeling lost, and compared to your situation where you have little to no network i understand it can be hard. I am not sure a move will fix it, becuase it is still the same things you need to work on. That being said, being at a new place, can kickstart, but be aware that the moving it self will not fix your situation. It is also hard to date in US, and school will still take a lot of time and focus etc. If you want to travel and study abroad do it! But also start working on the things your are bad at or missing NOW! Start dating now, start going out, join a team. Lastly, the American Dream is a big fat lie..
82 replies
CC#
Created by BlindWiz on 1/4/2024 in #help
Creating a SqlConnection connection via connection string
Post the full code its hard to know what you do, but it has probably something to do with you not opening the connection or disposing it.
4 replies