Comments (29)
Maybe use EF. Can cache.
Or some service with manual memory caching.
from budoco.
The lifecycle of the app, it's like a normal C# program. When it starts running the static classes like bd_util, bd_db, bd_config, and bd_session as well as Program and Startup a constructed and stay alive as singletons during the entire program. Any of them with global static variables, those variables serve as a cache.
The one thing to keep in mind is that the global static variables can be accessed by multiple threads, so need to be protected.
Look especially at bd_session, which I'm not using for anything, but I created it because I thought I was using it.
So, in other words, HOW to cache is not an issue.
What is an issue is that the logic for maintaining the cache is just one more thing that can be buggy, one more thing to break, so I don't want to do it if the benefit is small.
from budoco.
That's why I mentioned EF as it encapsulates all the work with cache.
from budoco.
Right, if ALL our database updates were done via EF, then EF caching would make sense, but it's either all or nothing. For EF to cache correctly we would have to do all updates via EF.
I debating whether to use EF or not during this rewrite but I just decided I wasn't interested. Maybe it would have been better, but I'm still happy with my choice.
from budoco.
For your english practice:
http://blogs.tedneward.com/post/the-vietnam-of-computer-science/
from budoco.
So many letters. 😄
from budoco.
I agree with many things. But something has changed since then.
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/anonymous-types
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/
from budoco.
Yeah, maybe the codebase would be better if I did the db stuff a different way.
what is the purpose of Where(x => true) in your example?
from budoco.
And that tool you are using where you can type C# code instead of sql into it, is there something like that available for linux?
from budoco.
"Bugs" is an EF model?
from budoco.
Yeah, maybe the codebase would be better if I did the db stuff a different way.
what is the purpose of Where(x => true) in your example?
The predicate is always true, get all records.
from budoco.
And that tool you are using where you can type C# code instead of sql into it, is there something like that available for linux?
from budoco.
"Bugs" is an EF model?
Like https://docs.microsoft.com/en-us/dotnet/api/system.linq.iqueryable-1?view=net-5.0
from budoco.
https://forum.linqpad.net/discussion/1983/roadmap-for-cross-platform-ubuntu-linux
from budoco.
Concerning concepts:
Identity
https://docs.microsoft.com/en-us/dotnet/api/system.guid?view=net-5.0
https://docs.microsoft.com/en-us/visualstudio/ide/reference/generate-equals-gethashcode-methods?view=vs-2019
State
https://en.wikipedia.org/wiki/Data_transfer_object
Behavior
https://en.wikipedia.org/wiki/Service_statelessness_principle
Inheritance
https://en.wikipedia.org/wiki/Inversion_of_control
from budoco.
https://forum.linqpad.net/discussion/1983/roadmap-for-cross-platform-ubuntu-linux
I think EF with console logging will show SQL.
from budoco.
Concerning concepts:
Identity
https://docs.microsoft.com/en-us/dotnet/api/system.guid?view=net-5.0
https://docs.microsoft.com/en-us/visualstudio/ide/reference/generate-equals-gethashcode-methods?view=vs-2019State
https://en.wikipedia.org/wiki/Data_transfer_objectBehavior
https://en.wikipedia.org/wiki/Service_statelessness_principleInheritance
https://en.wikipedia.org/wiki/Inversion_of_control
I don't understand why you are sending this to me. I don't understand how it relates to what we've talked about. Please explain.
from budoco.
I'm timing how long it takes Issue.cshtml.cs OnGet, and it's usually about 20 milliseconds, so there's no point in trying to optimize it more, it's already so fast.
from budoco.
I don't understand why you are sending this to me. I don't understand how it relates to what we've talked about. Please explain.
These issues are addressed in the article. I thought this might be interesting.
Object systems are typically characterized by four basic components: identity, state, behavior and encapsulation. Identity is an implicit concept in most O-O languages, in that a given object has a unique identity that is distinct from its state (the value of its internal fields)–two objects with the same state are still separate and distinct objects, despite being bit-for-bit mirrors of one another. This is the “identity vs. equivalence” discussion that occurs in languages like C++, C# or Java, where developers must distinguish between “a == b” and “a.equals(b)”.
From article.
from budoco.
I'm timing how long it takes Issue.cshtml.cs OnGet, and it's usually about 20 milliseconds, so there's no point in trying to optimize it more, it's already so fast.
👍
from budoco.
Sorry, I don't understand how the quote about identity relates to decisions about how to code Budoco.
from budoco.
This applies to EF or ORM.
Although the article shows the problem, but, as far as I know, this is solved.
from budoco.
"this is solved". WHAT is solved? I still don't understand how this discussion relates to decisions about how to code Budoco.
from budoco.
In the article, as I understand it, it was said that it is difficult to unambiguously map the database model to objects. Since objects have unique links.
from budoco.
In the second case, "Name" became a unique key as in the database.
from budoco.
You read the article more carefully than me!
I dislike having to learn an API (EF) to write a language that I already know how to write (SQL).
The abstraction is super leaky, like N+1, or any query that returns something that isn't a "User", but rather just a column from the users table, or a join between two tables.
If I just want everything LINQ'ified, then maybe Dapper would be good, but 99% of what i do is just foreach (DataRow dr.... so why would I bring in another library just so that it loads the DataTable results into a different kind of collection?
There are some things I like about ORMs:
-
a Migration system for free. But it's not too hard to write one. A dozen lines of code. But, I still have to write and test it.
-
Putting together a complex SQL statement at runtime. Rails ActiveRecord is really good for this. Doing it with string the way I did it in BugTracker.NET, that's messy. But Budoco does way way way less with dynamic sql, and the most complicated sql is outside the C# code - the sql that's in the external queries and reports. The whole culture of Budoco/BugTracker.NET is YOU HAVE TO LIKE WRITING SQL.
from budoco.
The abstraction is super leaky, like N+1, or any query that returns something that isn't a "User", but rather just a column from the users table, or a join between two tables.
Don't use object graph.
All libraries over SQL solve other problems in parallel: caching, code duplication, security ...
Of course, all this is not unambiguous.
from budoco.
https://owasp.org/www-community/attacks/SQL_Injection
https://owasp.org/www-project-top-ten/
from budoco.
The solve all problems except for the 1,400 open issues against EF.
from budoco.
Related Issues (20)
- Fix posts N+1 HOT 1
- History posts - "status was changed from foo to bar by somebody on date" HOT 1
- Let incoming emails create issues, not just posts to issues. HOT 1
- reorganize sql scripts. clearly define the prod ones from the demo ones. HOT 1
- Issues, history posts, for changes to description and details, something better than [hover to view] HOT 20
- Incoming email post, "Reply".
- Electron screenshot tool that can post to Budoco, like the old BugTracker.NET tool HOT 31
- create "migration" scheme HOT 1
- Add side-by-side diff showing in "Before and After" modal.
- Auto reply to emails that create new issues
- For incoming emails, enhance the org with email domain that can be used for org assignment
- Admin, Pending Users, "Update" link goes to non-existent page.
- I don't know how to allow a post from a "foreign" source (for posting screenshots from separate app) HOT 5
- column "rp_desc" does not exist HOT 1
- IIS hosting is not working in windows 10 HOT 2
- [Feature request] Migration from BugTracker.Net to Budoco ? HOT 2
- Can not skip registration page as admin HOT 9
- Wrong search URL HOT 1
- Requesting for installation instructions on Mac OS (Sonoma)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from budoco.