Base solution for your next web application

Activities of "jehadk"

How I can send to you my logs

YEs useing EF , are there another way

my Database is SQL server but I need to connect to another Database(Oracle) to call some SP

AspNetCore, Version=3.5.0.0

Yes I installed dotnet-hosting-2.1.2-win (<a class="postlink" href="https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.1.3-windows-hosting-bundle-installer">https://www.microsoft.com/net/download/ ... -installer</a>)

<a class="postlink" href="http://localhost/BarznWeb.BarznWeb.Web.Mvc/swagger/">http://localhost/BarznWeb.BarznWeb.Web.Mvc/swagger/</a>

or

<a class="postlink" href="http://localhost/BarznWeb.BarznWeb.Web.Mvc/swagger/v1/swagger.json">http://localhost/BarznWeb.BarznWeb.Web. ... agger.json</a>

But when run the VS on debug mode and call the web browser using the following link <a class="postlink" href="http://localhost:62114/swagger/">http://localhost:62114/swagger/</a> the swagger is working fine

Can you please support me with sample of code working on the ASPZero version 3.5

<cite>aaron: </cite> Tip: Wrap your code in the following for formatting and readability:

[code]

[/code:39lrdbwm] A shortcut is to highlight your code and click on the </> button in the formatting toolbar.

I did that wrap my code in <code> tage can tell me what the next step to apply the filter on the all query

Sorry I set the below implementation 1)

public interface IHasCustomer
    {
        string InsCustID { get; set; }
    }
  1. override ShouldFilterEntity and CreateFilterExpression as below
protected override bool ShouldFilterEntity<TEntity>(IMutableEntityType entityType)
        {
            return base.ShouldFilterEntity<TEntity>(entityType);
        }
         protected override Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>()
        {
            Expression<Func<TEntity, bool>> expression = null;

            if (typeof(IHasCustomer).IsAssignableFrom(typeof(TEntity)))
            {
                                Expression<Func<TEntity, bool>> mustHaveTenantFilter = e => ((IHasCustomer)e).InsCustID == GetCurrentCustomerIdOrNull() || (((IHasCustomer)e).InsCustID == GetCurrentCustomerIdOrNull()) == true;
                expression = expression == null ? mustHaveTenantFilter : CombineExpressions(expression, mustHaveTenantFilter);
            }
            return base.CreateFilterExpression<TEntity>();
        }

my question what the next to run and apply the filter

I have aspzero, can you please provide us with example to set custom filler ?

Answer

OK, Thanks for your support.

How I can attach file to the email? does Frame Work support the attachment file when send the email ??

Answer

Dear I commit the ReplaceService for IEmailSenderConfiguration but the password sent intercepted, so I back the code as below but in same time I have error
MailKit.Security.AuthenticationException: 'AuthenticationInvalidCredentials: 5.7.3 Authentication unsuccessful'

public class DefaultMailKitSmtpBuilder : IMailKitSmtpBuilder, ITransientDependency { private readonly ISmtpEmailSenderConfiguration _smtpEmailSenderConfiguration; //private readonly IAbpMailKitConfiguration _abpMailKitConfiguration;

    public DefaultMailKitSmtpBuilder(ISmtpEmailSenderConfiguration smtpEmailSenderConfiguration)
    {
        _smtpEmailSenderConfiguration = smtpEmailSenderConfiguration;

    }

    public virtual SmtpClient Build()
    {
        var client = new SmtpClient();

        try
        {
            ConfigureClient(client);
            return client;
        }
        catch
        {
            client.Dispose();
            throw;
        }
    }

    protected virtual void ConfigureClient(SmtpClient client)
    {
        client.Connect(
        _smtpEmailSenderConfiguration.Host,
        _smtpEmailSenderConfiguration.Port,SecureSocketOptions.None
        
        );

        if (_smtpEmailSenderConfiguration.UseDefaultCredentials)
        {
            return;
        }
        
        
    client.Authenticate(
        _smtpEmailSenderConfiguration.UserName,
        _smtpEmailSenderConfiguration.Password
        );
    }

    protected virtual SecureSocketOptions GetSecureSocketOption()
    {

        return _smtpEmailSenderConfiguration.EnableSsl
        ? SecureSocketOptions.SslOnConnect
        : SecureSocketOptions.StartTlsWhenAvailable;
    }
}
[DependsOn(
    typeof(AbpZeroCoreModule),
    typeof(AbpZeroLdapModule),
    typeof(AbpAutoMapperModule),
    typeof(AbpAspNetZeroCoreModule),
    typeof(AbpMailKitModule))]
public class BarznWebCoreModule : AbpModule
{
    public override void PreInitialize()
    {
        //workaround for issue: &lt;a class=&quot;postlink&quot; href=&quot;https://github.com/aspnet/EntityFrameworkCore/issues/9825&quot;&gt;https://github.com/aspnet/EntityFramewo ... ssues/9825&lt;/a&gt;
        //related github issue: &lt;a class=&quot;postlink&quot; href=&quot;https://github.com/aspnet/EntityFrameworkCore/issues/10407&quot;&gt;https://github.com/aspnet/EntityFramewo ... sues/10407&lt;/a&gt;
        AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue9825", true);

        Configuration.Auditing.IsEnabledForAnonymousUsers = true;

        //Declare entity types
        Configuration.Modules.Zero().EntityTypes.Tenant = typeof(Tenant);
        Configuration.Modules.Zero().EntityTypes.Role = typeof(Role);
        Configuration.Modules.Zero().EntityTypes.User = typeof(User);

        BarznWebLocalizationConfigurer.Configure(Configuration.Localization);

        //Adding feature providers
        Configuration.Features.Providers.Add&lt;AppFeatureProvider&gt;();

        //Adding setting providers
        Configuration.Settings.Providers.Add&lt;AppSettingProvider&gt;();

        //Adding notification providers
        Configuration.Notifications.Providers.Add&lt;AppNotificationProvider&gt;();

        //Enable this line to create a multi-tenant application.
        Configuration.MultiTenancy.IsEnabled = BarznWebConsts.MultiTenancyEnabled;
        
        //Enable LDAP authentication (It can be enabled only if MultiTenancy is disabled!)
        //Configuration.Modules.ZeroLdap().Enable(typeof(AppLdapAuthenticationSource));

        //Configure roles
        AppRoleConfig.Configure(Configuration.Modules.Zero().RoleManagement);

        //if (DebugHelper.IsDebug)
        //{
        //    //Disabling email sending in debug mode
        //    Configuration.ReplaceService&lt;IEmailSender, NullEmailSender&gt;(DependencyLifeStyle.Transient);
        //}


        //Configuration.ReplaceService(typeof(IEmailSenderConfiguration), () =>
        //{
        //    Configuration.IocManager.IocContainer.Register(
        //        Component.For&lt;IEmailSenderConfiguration, ISmtpEmailSenderConfiguration&gt;()
        //                 .ImplementedBy&lt;BarznWebSmtpEmailSenderConfiguration&gt;()
        //                 .LifestyleTransient()
        //    );
        //});
        Configuration.ReplaceService(typeof(IEmailSenderConfiguration), () =>
        {
            Configuration.IocManager.IocContainer.Register(
                Component.For&lt;IEmailSenderConfiguration, ISmtpEmailSenderConfiguration&gt;()
                         .ImplementedBy&lt;BarznWebSmtpEmailSenderConfiguration&gt;()
                         .LifestyleTransient()
            );
        });
        Configuration.ReplaceService&lt;IMailKitSmtpBuilder, DefaultMailKitSmtpBuilder&gt;(DependencyLifeStyle.Transient);

        Configuration.Caching.Configure(FriendCacheItem.CacheName, cache =>
        {
            cache.DefaultSlidingExpireTime = TimeSpan.FromMinutes(30);
        });

        Configuration.Caching.Configure(PaymentCacheItem.CacheName, cache =>
        {
            cache.DefaultSlidingExpireTime = TimeSpan.FromMinutes(BarznWebConsts.PaymentCacheDurationInMinutes);
        });
    }

    public override void Initialize()
    {
        IocManager.RegisterAssemblyByConvention(typeof(BarznWebCoreModule).GetAssembly());
    }

    public override void PostInitialize()
    {
        IocManager.RegisterIfNot&lt;IChatCommunicator, NullChatCommunicator&gt;();

        IocManager.Resolve&lt;ChatUserStateWatcher&gt;().Initialize();
        IocManager.Resolve&lt;AppTimes&gt;().StartupTime = Clock.Now;
    }
}

}

public class BarznWebSmtpEmailSenderConfiguration : SmtpEmailSenderConfiguration { public BarznWebSmtpEmailSenderConfiguration(ISettingManager settingManager) : base(settingManager) {

    }

    public override string Password => SimpleStringCipher.Instance.Decrypt(GetNotEmptySettingValue(EmailSettingNames.Smtp.Password));
}
Showing 1 to 10 of 16 entries