Base solution for your next web application

Activities of "mpm"

Question

Halil,

I'm not certain I fully understand how to enable LDAP integration. I've Enabled LDAP in the CoreModule.cs as follows:

//Enable this line to create a multi-tenant application.
//Configuration.MultiTenancy.IsEnabled = true;

//Enable LDAP authentication (It can be enabled only if MultiTenancy is disabled!)
Configuration.Modules.ZeroLdap().Enable(typeof(AppLdapAuthenticationSource));

I'm not sure of the next steps? Do I need to drop in a LdapSettingProvider and LdapSettings class, then call Configuration.Settings.Providers.Add<LdapSettingProvider>?

Are changes needed in the AccountController to support LDAP.

Thanks for your assistance, MPM

Answer

<cite>hikalkan: </cite> No, that's all. Run the application, login and open settings page, you will see LDAP settings. It's completely integrated to the system. See TenantSettingsAppService to know how to get/set LDAP settings.

That worked perfectly, thank you.

I've created a unit test for creating a device object with a DeviceName, Site, and IsTraining bit. AutoMapper is throwing out the following error in the test. I'm not sure why my DTO and Domain object aren't able to map properly.

Result Message: AutoMapper.AutoMapperMappingException : Missing type map configuration or unsupported mapping.

Mapping types: DeviceEditDto -> Device MCMT.PatientCareReporting.Devices.Dto.DeviceEditDto -> MCMT.PatientCareReporting.Devices.Device

My test looks like so:

public class DeviceAppService_Create_Tests : DeviceAppServiceTestBase
    {
        [Fact]
        public async Task Should_Create_Device()
        {
            LoginAsHostAdmin();

            await CreateDeviceAndTestAsync("TESTDEVICE", "Rochester", false);
            await CreateDeviceAndTestAsync("R5001011", "Austin", true);
        }

        private async Task CreateDeviceAndTestAsync(string deviceName, string site, bool isTraining)
        {
            //Act
            await DeviceAppService.CreateOrUpdateDevice(
                new CreateOrUpdateDeviceInput
                {
                    Device = new DeviceEditDto
                    {
                        DeviceName = deviceName,
                        Site = site,
                        IsTraining = isTraining
                    }
                });

            //Assert
            UsingDbContext(async context =>
            {
                //Get created device
                var createdDevice = await context.Devices.FirstOrDefaultAsync(u => u.DeviceName == "TESTDEVICE");
                createdDevice.ShouldNotBe(null);

                //Check some properties
                createdDevice.Site.ShouldBe("Rochester");
                createdDevice.IsTraining.ShouldBe(false);
            });
        }
    }

My domain object is as follows:

[Table("rntDevice")]
    public class Device : FullAuditedEntity
    {
        public const int MaxDeviceNameLength = 10;
        public const int MaxSiteLength = 32;
        
        [Required]
        [MaxLength(MaxDeviceNameLength)]
        public virtual string DeviceName { get; set; }

        [Required]
        [MaxLength(MaxSiteLength)]
        public virtual string Site { get; set; }
 
        public virtual bool IsTraining { get; set; }
    }

and the DTO object looks like so:

public class DeviceEditDto : IValidate
    {
        /// <summary>
        /// Set null to create a new device. Set device's Id to update a device
        /// </summary>
        public long? Id { get; set; }

        [Required]
        [StringLength(Device.MaxDeviceNameLength)]
        public string DeviceName { get; set; }

        [Required]
        [StringLength(Device.MaxSiteLength)]
        public string Site { get; set; }

        public bool IsTraining { get; set; }
    }

Any thoughts I what I might have wired together incorrectly?

Question

The app I am working on right now has two DbContext, and two controllers. The first controller (using the default DbContext) is logging to the audit log with no issue. The second controller (using the second DbContext) is not logging anything to the audit log.

Do you have any thoughts on possible causes?

Answer

Hi Halil.

In order to get the two DbContext's to work at all, I had already enabled DTC.

Security Settings

- Network DTC Access checked
      - Client and Administration
             - Allow Remote Clients checked
             - Allow Remote Administration unchecked
      - Transaction Manager Communication
             - Allow Inbound checked
             - Allow Outbound checked
             - Mutual Authentication Required is selected
     -  Enable XA Transactions unchecked
      - Enable SNA LU 6.2 Transactions checked

Thanks for checking into this.

Answer

Much appreciated.

Sorry for the simple question, but how does one change the default backend app from AngularJS to MPA.

Thanks, MPM

Hi,

My question is even more basic than that. How do I configure a newly created app to use the MPA backend, rather than the AngularJS backend. I think by default the app uses the AngularJS backend.

Thank you very much!

You may want to take a look at the calendar component that is included with the Metronic template that ASP.NET Zero uses. You can see a sample of it here.

Showing 1 to 10 of 12 entries