Base solution for your next web application

Activities of "willignicolas"

Hello,

Our version : ASP.NET CORE MVC & jQuery .NET Core 3.1 v8.2.1

We facing a problem with radtool (2.2.0.4) when regenerating an existing entity for add 2 new string property.

We have migrate to the 8.2.1 a few weeks ago and not use the rad tool since.

Thanks for your help, tell me if you need any other informations for the diagnostic.

Nicolas.

-> MachinesAppService.cs is being generated.
Warning: System.Exception: Word can not be null. exiting...
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Lower(String word)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.ReplaceAlsoWithLowerCase(String template, String placeholder, String value)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Replace(String template, EntityConfiguration entity, Property property, EnumDefinition enumDefinition, NavigationProperty navigationProperty)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.SetEnums()
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.GenerateAndGetContent()
   at AspNetZeroRadTool.GeneratorFromTemplate.FileGeneratorBasedOnEntity(TemplateInfo templateInfo, TemplatePathInfo templatePathInfo, String targetFolderRoot, EntityConfiguration entity)
-> IMachinesAppService.cs is being generated.
-> MachineConsts.cs is being generated.
-> CreateOrEditMachineDto.cs is being generated.
Warning: System.Exception: Word can not be null. exiting...
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Lower(String word)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.ReplaceAlsoWithLowerCase(String template, String placeholder, String value)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Replace(String template, EntityConfiguration entity, Property property, EnumDefinition enumDefinition, NavigationProperty navigationProperty)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.SetEnums()
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.GenerateAndGetContent()
   at AspNetZeroRadTool.GeneratorFromTemplate.FileGeneratorBasedOnEntity(TemplateInfo templateInfo, TemplatePathInfo templatePathInfo, String targetFolderRoot, EntityConfiguration entity)
-> MachineDto.cs is being generated.
Warning: System.Exception: Word can not be null. exiting...
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Lower(String word)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.ReplaceAlsoWithLowerCase(String template, String placeholder, String value)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Replace(String template, EntityConfiguration entity, Property property, EnumDefinition enumDefinition, NavigationProperty navigationProperty)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.SetEnums()
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.GenerateAndGetContent()
   at AspNetZeroRadTool.GeneratorFromTemplate.FileGeneratorBasedOnEntity(TemplateInfo templateInfo, TemplatePathInfo templatePathInfo, String targetFolderRoot, EntityConfiguration entity)
-> GetAllMachinesForExcelInput.cs is being generated.
-> GetAllForLookupTableInput.cs is being generated.
-> GetAllMachinesInput.cs is being generated.
-> GetMachineForViewDto.cs is being generated.
-> GetMachineForEditOutput.cs is being generated.
-> MachineShopfloorLookupTableDto.cs is being generated.
-> MachineAgentLookupTableDto.cs is being generated.
-> MachineDirectoryLookupTableDto.cs is being generated.
-> Machine.cs is being generated.
Warning: System.Exception: Word can not be null. exiting...
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Lower(String word)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.ReplaceAlsoWithLowerCase(String template, String placeholder, String value)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Replace(String template, EntityConfiguration entity, Property property, EnumDefinition enumDefinition, NavigationProperty navigationProperty)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.SetEnums()
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.GenerateAndGetContent()
   at AspNetZeroRadTool.GeneratorFromTemplate.FileGeneratorBasedOnEntity(TemplateInfo templateInfo, TemplatePathInfo templatePathInfo, String targetFolderRoot, EntityConfiguration entity)
-> MachinesExcelExporter.cs is being generated.
-> IMachinesExcelExporter.cs is being generated.
-> AppPermissions.cs is being modified.
-> AppAuthorizationProvider.cs is being modified.
-> GekkoDbContext.cs is being modified.
-> CustomDtoMapper.cs is being modified.
Running add-migration...
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET Core program, but dotnet-ef does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
-> MachinesController.cs is being generated.
-> _CreateOrEditModal.cshtml is being generated.
Warning: System.Exception: Word can not be null. exiting...
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Lower(String word)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.ReplaceAlsoWithLowerCase(String template, String placeholder, String value)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Replace(String template, EntityConfiguration entity, Property property, EnumDefinition enumDefinition, NavigationProperty navigationProperty)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.SetEnums()
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.GenerateAndGetContent()
   at AspNetZeroRadTool.GeneratorFromTemplate.FileGeneratorBasedOnEntity(TemplateInfo templateInfo, TemplatePathInfo templatePathInfo, String targetFolderRoot, EntityConfiguration entity)
-> _CreateOrEditModal.js is being generated.
-> _CreateOrEditModal.min.js is being generated.
-> CreateOrEditMachineViewModel.cs is being generated.
-> Index.cshtml is being generated.
Warning: System.Exception: Word can not be null. exiting...
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Lower(String word)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.ReplaceAlsoWithLowerCase(String template, String placeholder, String value)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.PlaceholderReplacer.Replace(String template, EntityConfiguration entity, Property property, EnumDefinition enumDefinition, NavigationProperty navigationProperty)
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.SetEnums()
   at AspNetZeroRadTool.FileWizards.FileGenerators.Generic.GenericFileContentGenerator.GenerateAndGetContent()
   at AspNetZeroRadTool.GeneratorFromTemplate.FileGeneratorBasedOnEntity(TemplateInfo templateInfo, TemplatePathInfo templatePathInfo, String targetFolderRoot, EntityConfiguration entity)
-> Index.js is being generated.
-> Index.min.js is being generated.
-> _MachineShopfloorLookupTableModal.cshtml is being generated.
-> _MachineAgentLookupTableModal.cshtml is being generated.
-> _MachineDirectoryLookupTableModal.cshtml is being generated.
-> _MachineShopfloorLookupTableModal.js is being generated.
-> _MachineAgentLookupTableModal.js is being generated.
-> _MachineDirectoryLookupTableModal.js is being generated.
-> MachineMachineShopfloorLookupTableViewModel.cs is being generated.
-> MachineMachineAgentLookupTableViewModel.cs is being generated.
-> MachineMachineDirectoryLookupTableViewModel.cs is being generated.
-> _ViewMachineModal.cshtml is being generated.
-> MachineViewModel.cs is being generated.
-> MachinesViewModel.cs is being generated.
-> AppNavigationProvider.cs is being modified.
-> AppPageNames.cs is being modified.
-> Gekko.xml is being modified.

Code generation is complete. Press ENTER to exit...

Hello,

I have injected Two instances from the same interface like that :

 IBlobStorage storage = StorageFactory.Blobs.DirectoryFiles(directory);
            _iocManager.IocContainer.Register(
                Castle.MicroKernel.Registration.Component.For<IBlobStorage>().Instance(storage).Named(fileProviderName)
            );

I resolve this instance like that :

 FileProvider = _iocManager.IocContainer.Resolve<IBlobStorage>(FileProviderName);

I don't use IIocResolver or IScopedIocResolver because they don't have a resolve method by name but all work fine with that method.

I have read that if i resolve my instances with iocContainer I must release it. I'm in a domainservice context but I don't know where to do the release (I use my instance in many methods in my domain service). I have put a IDisposable interface on my domainservice but the debugger never go to the dispose method.

Have you an idea where to put this release or maybe on other method to resolve the named instance?

Thanks for your help.

Nicolas.

Hi ,

I'm trying to implement interceptor on an instantiated class with castle windsor, but no methods are intercepted in this case. All works fine with normally registered components, Castle Windsor intercepts all the methods of my component.

I know that by design Castle Windsor cannot intercept a registered instantiated class, but I was saw this post and tried to implement it with no luck: https://stackoverflow.com/questions/12162769/castle-windsor-cannot-intercept-component-registered-for-a-class-instance

This is my current implementation :

My Factory Interface :

<br>

public interface ITransferProtocolFactory { ITransferProtocol GetTransferProtocol(string transferProtocolName); }

Registration of the factory:

<br>

IocManager.IocContainer.AddFacility<TypedFactoryFacility>(); 
IocManager.IocContainer.Register(Component.For<ITransferProtocolFactory>().AsFactory(new NamedTypeFactory())); 
IocManager.IocContainer.Register(Component.For<NamedTypeFactory, ITypedFactoryComponentSelector>());

Override of the GetComponentName method :

public class NamedTypeFactory : DefaultTypedFactoryComponentSelector 
{
    protected override string GetComponentName(MethodInfo method, object[] arguments)
    {
        string componentName = null;
        if (arguments != null && arguments.Length > 0)
        {
            componentName = arguments[0] as string;
        }
        if (string.IsNullOrEmpty(componentName))
            componentName = base.GetComponentName(method, arguments);
        return componentName;
    }
}

Registering my interceptor :

public static class InterceptorsRegistrar
{
    public static void Initialize(IKernel kernel)
    {
        kernel.ComponentRegistered += Kernel_ComponentRegistered;
    }

    private static void Kernel_ComponentRegistered(string key, IHandler handler)
    {
        if (typeof(ITransferProtocol).IsAssignableFrom(handler.ComponentModel.Implementation) &&
                !typeof(IProxyTransferUserAction).IsAssignableFrom(handler.ComponentModel.Implementation))
        {
            handler.ComponentModel.Interceptors.Add
                (new InterceptorReference(typeof(TransferUserActionInterceptor)));
        }
    }
}

InterceptorsRegistrar.Initialize(IocManager.IocContainer.Kernel);

Creation of instance and registration :

public void CreateAndInjectMachineProtocol(MachineForAgentDto machine)
{
    var machineProtocol = (ITransferProtocol)Activator.CreateInstance(Type.GetType("Agent.Protocols." + Enum.GetName(typeof(eCommunicationType), machine.CommunicationType)));

    _iocManager.IocContainer.Register(Component.For<ITransferProtocol>().Instance(machineProtocol).Named(nameof(ITransferProtocol) + machine.Id.ToString()).LifestyleSingleton());
}

The Interceptor :

<br>

public class TransferUserActionInterceptor : IInterceptor
{
    private readonly IMachineManager _machineManager;

    public TransferUserActionInterceptor(IMachineManager machineManager)
    {
        _machineManager = machineManager;
    }

    public void Intercept(IInvocation invocation)
    {
        invocation.Proceed();
    }
}

And finally the resolver of the component through the factory:

<br>

private ITransferProtocol GetMachineProtocol(long machineId)
{
    return _transferProtocolFactory.GetTransferProtocol(nameof(ITransferProtocol) + machineId.ToString());
}

The Interception is not working in this case because of the design limitation of Castle Windsor.

I have tried to implement this solution https://stackoverflow.com/questions/12162769/castle-windsor-cannot-intercept-component-registered-for-a-class-instance but the interception continue not to working (maybe I have implemented it wrong).

So here are my 2 questions :

How can I implement the stackoverflow post solution on top of my current code to let methods of the ITransferProtocol injected instance be intercepted?

Do you have another solution that the stackoverflow post suggest?

Thanks for your help.

Nicolas

Question

Hi,

I have just merged our asp.net core + Jquery app with the latest version 7.1.0.

I can debug my app with iis express but the app exit with iis. (Ok before the merge)

There is the last logs on visual output :

The program '[13860] w3wp.exe' has exited with code -42 (0xffffffd6). The program '[13860] w3wp.exe: Program Trace' has exited with code 0 (0x0).

I can see 2 error in this logs :

'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.5\System.Threading.ThreadPool.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. EventSource Error: ERROR: Exception during construction of EventSource System.Transactions.TransactionsEventSource: Fonction incorrecte 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Users\nicolas.willig.nuget\packages\system.text.encoding.codepages\4.5.1\runtimes\win\lib\netcoreapp2.0\System.Text.Encoding.CodePages.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Users\nicolas.willig.nuget\packages\system.runtime.compilerservices.unsafe\4.5.2\lib\netcoreapp2.0\System.Runtime.CompilerServices.Unsafe.dll'. Module was built without symbols. 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.5\Microsoft.Win32.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.http.extensions\2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.5\System.Net.WebClient.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. EventSource Error: ERROR: Exception during construction of EventSource System.Data.DataCommonEventSource: Fonction incorrecte 'w3wp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.webutilities\2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'w3wp.exe' (CoreCLR: clrhost): Loaded 'DynamicProxyGenAssembly2'.

I have try to restore nugets, delete the iis website.

I can see that before the merge on the output it's dotnet.exe and now it's w3wp.exe.

Thanks for your Help. Nicolas.

Hello,

I have a custom hub on my asp.net zero app. (Core + Jquery 7.0.0)

I like the way we can strongly typed a hub in asp.net core https://docs.microsoft.com/fr-fr/aspnet/core/signalr/hubs?view=aspnetcore-2.2#strongly-typed-hubs

I have search to do that with asp.net zero signalr classes with no success. Is there any solution or evolution plan?

Thanks for your help. Nicolas.

Hello,

I'm new in asp.net zero.

We use asp.net zero core jquery

I try to use the wizard component from metronic according this documentation https://keenthemes.com/metronic/?page=docs&section=wizard

The wizard.js file is already in the mvc project, cool.

But it seems to have a lot of difference compared to the html code provided in the metronic documentation. Here are several examples:

  • in the metronic documentation the css classes in general starts with kt -... whereas in asp.net zero it is the classes m -... that are searched for.
  • in the file wizard.js the update of the ui looks for classes that does not exist in the html example (ex: m-wizard-target to manage the display of my step, there is many other exemple)

In short I have the impression that there is a big difference between what is explained in the documentation and the file js provided in asp.net zero. What seems odd to me is the prefix of all classes that differs.

Is there a version problem?

Thanks for your help.

Best Regards, Nicolas.

Showing 1 to 6 of 6 entries