Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "bilalhaidar"

Thanks, no need to explain it. I went through all the related classes and it makes perfect sense :)

Given the fact, the AbpDbContext could have an unknown number of IDbSet<T> ahead of time, this code is needed.

In my case, I just want to map IFoo<T> or IFoo<T,Z> to Foo<T> or Foo<T,Z>, so I use this code and it seems to be working fine.

private void RegisterForReferenceDataManager()
        {
            IocManager.RegisterIfNot(
                typeof(IReferenceDataManager<,>),
                typeof(ReferenceDataManager<,>),
                DependencyLifeStyle.Singleton);
        }

One question though, what's the recommendation to use Singleton or Transient? When will each be used?

In case I am registering the classes as above, do I still need to have Foo<T> implement ISingletonDependency? As I understand, this interface is used only when doing the below so that CW would know how to register an interface and implementation. Correct?

IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());

Can you please explain a bit more on this code? I am not getting the idea.

Thank you.

public static class EfAutoRepositoryTypes
    {
        public static AutoRepositoryTypesAttribute Default { get; private set; }

        static EfAutoRepositoryTypes()
        {
            Default = new AutoRepositoryTypesAttribute(
                typeof(IRepository<>),
                typeof(IRepository<,>),
                typeof(EfRepositoryBase<,>),
                typeof(EfRepositoryBase<,,>)
            );
        }
    }

var autoRepositoryAttr = dbContextType.GetSingleAttributeOrNull<AutoRepositoryTypesAttribute>() ??
                                     EfAutoRepositoryTypes.Default;

            foreach (var entityTypeInfo in DbContextHelper.GetEntityTypeInfos(dbContextType))
            {
                var primaryKeyType = EntityHelper.GetPrimaryKeyType(entityTypeInfo.EntityType);
                if (primaryKeyType == typeof(int))
                {
                    var genericRepositoryType = autoRepositoryAttr.RepositoryInterface.MakeGenericType(entityTypeInfo.EntityType);
                    if (!iocManager.IsRegistered(genericRepositoryType))
                    {
                        var implType = autoRepositoryAttr.RepositoryImplementation.GetGenericArguments().Length == 1
                                ? autoRepositoryAttr.RepositoryImplementation.MakeGenericType(entityTypeInfo.EntityType)
                                : autoRepositoryAttr.RepositoryImplementation.MakeGenericType(entityTypeInfo.DeclaringType, entityTypeInfo.EntityType);

                        iocManager.Register(
                            genericRepositoryType,
                            implType,
                            DependencyLifeStyle.Transient
                            );
                    }
                }

I will be using it in one View, so where do you think best to add it? On the View itself?

Thank you.

Oh Excellent :)

so if I want to include any feature, I make sure that I load all js/css files (if they are not already loaded) and use them?

Regards Bilal

Thanks a lot :)

Where to place it? In the base class of the Views?

I did thanks, <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/454">https://github.com/aspnetzero/aspnet-zero/issues/454</a>

Thanks a lot

I can still inject an IXXXPolicy in the ApplicationService, and then I create run a method for example IXXXPolicy.Validate().

Inside that method I can contact DB to get for instance, if a field is required (this info should be stored in DB as client wants to dynamically change hide/show and required/optional on fields so I cannot use Data Annotations in this case). So this function would grab that info and accordingly validate. In case of something missing and it is required I can through AbpValidationException.

On the Domain Service level, still I can do other types of validations (business related ones). Then in this case I an through UserFriendlyExceptions.

Does this make sense?

Thanks

Showing 411 to 420 of 461 entries