Base solution for your next web application

Activities of "mohammed al-qaisi"

Answer

Hello All;

My Project structure like this

  • MyProject.Core
  • MyProject.App
  • MyProject.EF [list:20feq927][:20feq927]EmpRepository (Stored procedure here as above implementation)[/:m:20feq927] [:20feq927]MyProject.Test[/:m:20feq927][/list:u:20feq927]

In my test app

private readonly IEmpRepository _EmpRepository;
		//Constructor
		public UnitTestClass()
        {
           _EmpRepository = LocalIocManager.Resolve<IEmpRepository>();
        }
		[TestMethod]
        public void Should_Add_Employee_With_Authorized_User()
        {
           var result = _EmpRepository.GetAllWithDepartment(1);
           result.Count().ShouldBe(100);
        }
  • I got exception:"The operation cannot be completed because the DbContext has been disposed".
  • Is that the appropriate way to use this (like ref --MyProject.EF -- into --MyProject.Test--).

Thank you :)

Answer

Thank you

I use this:

public IEnumerable<Employee> GetAllWithDepartment(int? deptID)
        {

            var departmentIDParameter = deptID != null ?
            new SqlParameter("@dept_id", deptID) :
            new SqlParameter("@dept_id", typeof (int));

            return Context.Database.SqlQuery<Employee>("spGetEmployeesWithUsersWithDepartments @dept_id", departmentIDParameter);
        }
Question

Hello everybody:

i'm trying to execute a stored procedure in my app , i'm using (Module Zero) but i facing issue with (Create Query & Session)

Here is my code

public interface IEmpRepository : IRepository<Employee>
    {
        List<Employee> GetAllWithDepartment(int? deptID);
    }

    public class EmpRepository : EmployeesTasksRepositoryBase<Employee, int>, IEmpRepository
    {
        public EmpRepository(IDbContextProvider<EmployeesTasksDbContext> dbContextProvider)
            : base(dbContextProvider)
        {
        }

        public List<Employee> GetAllWithDepartment(int? deptID)
        {
            var query = Abp.Runtime.Session
                .CreateQuery("spGetEmployeesWithUsersWithDepartments")
                .SetParameter("deptId", deptID);               
        }
    }

Thank you all;

Answer

Wonderful .... Thanks again :D

Answer

Im very thankful :D hopefully this will work

Question

Hi All;

I'm so interested to use this framework in all my next project , so i download the template from the site

i trying to add Console app to "SimpleTaskSystem" but always i face the same problem

<span style="color:#FF0000">The Error</span> An unhandled exception of type 'Castle.MicroKernel.ComponentNotFoundException' occurred in Castle.Windsor.dll

Additional information: No component for supporting the service SimpleTaskSystem.ConsoleApp.testClass was found

<span style="color:#FF0000">The Code</span>

namespace SimpleTaskSystem.ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var bootstrapper = new AbpBootstrapper())
            {
                bootstrapper.Initialize();
                var tester = IocManager.Instance.Resolve<testClass>();
                tester.LoadAllPeopleAsync();
                Console.ReadLine();
            }
        }
    }
    public partial class testClass
    {
        private readonly IPersonAppService _personAppService;
        public testClass(IPersonAppService personAppService)
        {
            _personAppService = personAppService;
        }
        public async void  LoadAllPeopleAsync()
        {
            var result = await  _personAppService.GetAllPeople();
            foreach (var person in result.People)
            {
                Console.WriteLine(person.Name);
            }
        }
    }
}

Is there any thing to do with this issue.... :(

Showing 1 to 6 of 6 entries