question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request/Question: Ability to easily author/inject new directives for Razor?

See original GitHub issue

From @fir3pho3nixx on March 24, 2018 18:58

Currently, I cannot find an easy way to author/inject custom directives into Razor whilst using ASPNET Core Mvc(Kestrel).

I can see that the @Inject directive gets registered within razor here. Now if I wanted to inject a custom directive to MVC on startup how would I achieve that easily? Imagining for a second I wanted to create a ‘@FooInjector’.

I can see you offer access to RazorViewEngineOptions is this potentially where you guys would expose something like this?

Copied from original issue: aspnet/Mvc#7540

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
NTaylorMullencommented, Oct 5, 2021

@allisonchou compiler ❤️

1reaction
ghostcommented, Apr 14, 2018

Ok first of all, I totally respect your team and thanks for designing this product so well that I could inject new directives. Seriously job well done team. Your design is spot on keep it going …

** Warning crazy long ass rant with expletives about the fucking mentalists in the aspnet team. **

Why am I asking for this so soon?

Background

I have joined the castle project as an OSS contributor. We might all think they are “passed due” but unfortunately the fact is they invented the first IoC container for dotnet. They also had some really gifted developers which evolved their envisioning of what module inversion would look like today(sic: https://en.wikipedia.org/wiki/Inversion_of_control). IoC containers now are a dime a dozen. Windsor was first period, they learnt all of these problems a long time ago.

Crazy drugged up, drunken mother f%#king David Fowler invented Microsoft.Extensions.DependencyInjection.Abstractions. This made some really bold assumptions about how containers work today. It completely ignored the framework offering of the disposable pattern and augmented scoped behaviour with a god damn service locator pattern. F%#king rubbish really considering it earned us(Castle) the title of non-conforming container.

If you think service location is bad please ask Ploeh.

The point

The only reason I am asking for this feature via kestrel is because I believe I need to write a new @inject directive based on this experimental PR which led to this failed PR. Your work here is only expedited by the failings of https://github.com/aspnet/Mvc/issues/5403.

Conclusion

Please take your time on this one. You guys are doing a great job, I am unfortunately trying to work round what the aspnet d1ckh3ds gave us to work with. No rush.

Again this is not what I meant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ability to easily author/inject new directives for Razor? ...
Currently, I cannot find an easy way to author/inject custom directives into Razor whilst using ASPNET Core Mvc(Kestrel).
Read more >
What is a Feature Request? Understanding User Feedback
Requests to integrate with other products your customers use; Requests to update a popular existing functionality; Requests for completely new functionality.
Read more >
Product Feature Requests - How to Write and Submit Them
Describes the Feature Request process and provides tips on how to write a Feature Request for best results.
Read more >
Aligning Product Strategy with Customer Feature Requests
We've all been on customer calls where we're asked for a feature that just does not align with our product strategy.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found