Base solution for your next web application

Activities of "jesse"

Thank you for your answer,I have modified my code.

public int? UserId
        {
            get
            {
                var userId = HttpContext.Current.Session["UserId"];
                if (userId == null)
                {
                    return null;
                }
                return Convert.ToInt32(userId);
            }
            set { throw new NotImplementedException(); }
        }

but I'm worried about high concurrency and Multithreading, session will have problem,And mobile App can use like this?

<cite>hikalkan: </cite> Hi,

ProductAppService waiting for IProuctRepository but you're registering IRepository<Prouct>. You can change injected repository to IRepository<Prouct> or implement IProuctRepository by deriving from AdoRepositoryBase<Product>.

This is my implementation class has been deriving from GalaxyRepositoryBase<Product>,but cannot automatic injection

//Galaxy.Ado--ProductRepository.cs
  public class ProductRepository : GalaxyRepositoryBase<Product>, IProuctRepository
    {
        public List<Product> GetAll(int? id)
        {
            var products = new List<Product> { new Product { Id = 1 } };
            return products;
        }
    }
//Galaxy.Ado--GalaxyRepositoryBase.cs
public abstract class GalaxyRepositoryBase<TEntity, TPrimaryKey> : AdoRepositoryBase<TEntity, TPrimaryKey>
       where TEntity : class, IEntity<TPrimaryKey>
    {

    }
    public abstract class GalaxyRepositoryBase<TEntity> : GalaxyRepositoryBase<TEntity, int>
        where TEntity : class, IEntity<int>
    {
    }

When I coded this works good,But I want to automatically inject.

//Galaxy.Ado--GalaxyDataModule.cs
[DependsOn(typeof(GalaxyCoreModule), typeof(GalaxyDBModule))]
    public class GalaxyDataModule : AbpModule
    {
        public override void Initialize()
        {
            IocManager.IocContainer.Register(
                       Component.For<IProuctRepository>().ImplementedBy<ProductRepository>().LifestyleTransient()
                );
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }

I am a Chinese coder, my English is poor. Thank for you .

Showing 1 to 2 of 2 entries