Announcement Announcement Module
Collapse
No announcement yet.
Dependency not injecting Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dependency not injecting

    Hello

    I am fairly new to Spring.net, even though I have used it before it was a long time ago and under guidance.

    I am trying to develop a fairly simple application.
    I have 3 projects,
    1. Asp.Net web app
    2. Business Layer class library
    3. DAL Class library

    I am trying to inject the DAL into the Business Layer, but the DAL in the business layer is always null.

    My springconfig is in my web app and looks like this

    <?xml version="1.0" encoding="utf-8" ?>
    <objects xmlns="http://www.springframework.net"
    xmlns:db="http://www.springframework.net/database">

    <dbrovider id="dbProvider"
    provider="System.Data.SqlClient"
    connectionString="Data Source=XXXX;Initial Catalog=XXXXX;Integrated Security=True;"/>

    <object id="adoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">
    <property name="DbProvider" ref="dbProvider"/>
    <property name="DataReaderWrapperType" value="Spring.Data.Support.NullMappingDataReader, Spring.Data"/>
    </object>

    <object name="taskDAL" type="XXOdotDAL.TasksDAL.TasksDAL, XXOdotDAL">
    <property name="AdoOperations" ref="adoTemplate"/>
    </object>

    <object name="taskData" type="XXDot.Tasks.TaskData, XXDot">
    <property name="taskDAL" ref="taskDAL"/>
    </object>

    </objects>

    The code in my business layer is as follows

    public ITasksDAL taskDAL { get; set; }

    public IList<Task> GetTasks(bool completed)
    {
    IList<Task> allTasks = null;
    try
    {
    IList<TaskDO> tasksList = taskDAL.GetTasks(completed);
    allTasks = MapRows(tasksList);
    }
    catch (Exception ex)
    {
    throw ex;
    }

    return allTasks;
    }
    Anybody have any ideas what I am doing wrong or what I have missed out.
    Any help is appreciated
Working...
X