using imageresizer in another orchard module not working - module

I want to use the Image Resizer Module
in the Nwazet.ZenGallery Module (ZenGallery.cshtml).
But somehow, it's not working. When I use the #Html.Thumnail(...) inside a view in my theme, it works, but not in the view from the ZenGallery module. Why?
It says The type or namespace name 'Contrib' could not be found (are you missing a using directive or an assembly reference?)
How could I fix that?

I strongly suggest using ImageResizer directly instead of using Orchard Contrib.Thumbnails.
Contrib.Thumbnails violates ImageResizer best practices and takes an approach that has known stability issues.
There's also no need for Contrib.Thumbnails; ImageResizer already offers a URL API you can use directly, with better performance, stability, and a much cleaner syntax.

Related

File name convention for C# v10 global using declarations

Is there a consensus within the C# development community on the .cs filename in which global using statements are declared?
I was going to adopt the filename GlobalUsings.cs but then found that a hidden file called MyProject.GlobalUsings.g.cs is created behind the scenes by the VS2022 toolchain. This is to support the related new C# 10 feature called Implicit global using directives.
Blazor has supported a similar feature for .razor files and the Blazor solution template automatically creates a file called _Imports.razor. That name is derived from the Razor syntax to declare a using reference.
Short Answer
Usings.cs or maybe GlobalUsings.cs.
More Info
There are actually 2 new features. They seem really simple at first, but the more you read about it, the more complicated it becomes.
Global using directives. You can use global in front of any using directive in any file to make it global in the project.
Implicit usings. This automatically adds a set of common global using directives depending on the project type. You can enable this in a project that is upgraded to .NET 6 buy putting this in the project csproj file: <PropertyGroup><ImplicitUsings>enable</ImplicitUsings>...
Implicit usings is enabled by default on new .NET 6 projects, so it sounds like the convention is:
Use implicit usings.
You may still need a file to store global usings that are not implicit. I like your idea of GlobalUsings.cs. It's self-documenting.
In fact, this naming is recommended by the Welcome to C# 10 Blog. I highly recommend reading it; it was really helpful to me.
EDIT:
This seems to keep changing. .NET 6 project templates are now including a Usings.cs file.

Laravel 4 and dojo toolkit AMD implementation how to?

is anyone ever tried implementing the dojo toolkit AMD with laravel 4, or could anyone please point me to a simple sample.
just a simple AMD implemetation on laravel?
What asset manager or the default is ok. how to use it with dojo?
Please help. thanks
For 1. I suggest you may try this Laravel 4 bootstrap suite it gives you RequireJS implementation out of the box.
For 2. You can use dojo with any asset manager you want, or even without it (although it is not a good way) - just by putting its .js files in your /public directory and including them as you do in usual html from inside your view templates. If you are using Blade templates make sure the template syntax is not colliding with your js syntax. If it is, then use #include of .php file with your js code section in your .blade.php view template.
Asset manager gives you a more elegant and correct way of doing the same thing. It maybe extremely useful if you are dealing with LESS or Coffee things to be compiled into regular JS and styles.
If you want advanced asset manager I would suggest your to look at /CodeSleeve/asset-pipeline on github - it's one of many asset managers for Laravel, but one the few keeping alive (take a look at basset or laravel-grunt options on github for instance).
Asset Pipeline makes a good job making asset management similar to the one in Rails. Here is an article on how and why to use it: http://culttt.com/2013/11/04/add-asset-pipeline-laravel-4/

What DLL file do I need to add to my solution to use DbSet?

I am trying to use the generic DbSet class. I have tried adding the following references so far to my solution because the MSDN documentation states that DbSet lives inside System.Data.Entity:
However, as shown below I still cannot add a reference to System.Data.Entity, the only suggestion intellisense has is EntityClient which does not contain DbSet:
Resharper/Intellisense is not giving me any other suggestions of namespaces I could possibly add.
I have tried cleaning and rebuilding my solution, and I am using the .Net Framework 4 full version (not the client version).
I have tried using NuGet to search for EntityFramework and have found one result which I have added to no avail as is show below:
What DLL file do I need to add to my solution to add a reference to System.Data.Entity and use the DbSet class?
Thanks
The same MSDN reference page that you mention says that you need to reference EntityFramework.dll in your project.
Note that namespaces and assemblies are not the same thing. The following statement is a little over-simplified, but you can think of namespaces as residing inside (or becoming available by referencing) an assembly.
So, once you've referenced the assembly, you will still need the using System.Data.Entity; directive.

Namespace reference in .NET MVC3 Razor view in VB?

How do I reference a Namespace in .NET MVC3 with the Razor view engine?
I understand this can be done in C#:
#using Namespace;
However in VB this doesn't seem to work:
#Imports Namespace
(i'm talking about inside a .vbhtml file)
You're using the correct syntax for VB:
#Imports My.Full.Namespace
What I've found in a quick play around is:
Sub namespaces of the MVC project will be picked up by intellisense once the #Imports statement is added - must be the complete namespace.
If you're referencing a namespace outside of the current MVC project then intellisense won't pick it up unless you do a rebuild.
#Jonathan is correct, it's the correct syntax and it needs the full namespace of your extension methods.
If your extension methods are still not recognised, you may need to insert this import before your own namespace:
#Imports System.Web.Mvc.HtmlHelper
When I added this intellisense offered my extension methods. I think it's something to do with having a reference to System.Web.WebPages, which also defines a HtmlHelper class. Perhaps that explains why migrating the code to a new project solved the problem.
Unfortunately, the intellisense problem with the Import statement still persists, it doesn't offer the namespaces up.
I realise this answer is somewhat late in coming, however this has held me up half of the day - hope it helps someone else avoid this pitfall.

Displaying Version Information in a Web Service

Can anyone suggest a way of getting version information into a Web Service? (VB.NET)
I would like to dynamically use the assembly version in the title or description, but the attributes require constants.
Is manually writing the version info as a string the only way of displaying the information on the .asmx page?
Yeah, attributes cannot have anything but constants in them, so you cannot use reflection to get the version number. The WebServiceAttribute class is sealed too, so you cannot inherit it and do what you want from there.
A solution might be to use some kind of placeholder text as the Name, and set up an MsBuild task to replace it with the version number when building the project.
You need to pick a type in your assembly and then do the following:
typeof(Some.Object.In.My.Assembly).Assembly.GetName().Version;
via reflection you can get the Assembly object which contains the assembly version.