1
Answer

Unityconfig container

Peter Dzuya

Peter Dzuya

8y
284
1
Hi All,
 
I want bind data as shown here in below.
 
private readonly IStockItemService _stockItemService;
private readonly StockItem _stockItem;
public frmStockItenListing() {
InitializeComponent();
_stockItemService = UnityConfig.GetContainer().Resolve<IStockItemService>();
}
private void barButtonClose_ItemClick(object sender, ItemClickEventArgs e) {
if (MessageBox.Show("Are you sure", "GMIS - Close", MessageBoxButtons.YesNo, MessageBoxIcon.Information) ==
DialogResult.Yes) {
this.Close();
}
}
private void frmStockItenListing_Load(object sender, EventArgs e)
{
stockItemBindingSource.DataSource = _stockItemService.GetAll();
}
}
 
My Interface is as follows
 
 
namespace MakGarm.Business.Contracts {
public interface IStockItemService {
void Insert(StockItem entity);
void Update(StockItem entity);
StockItem GetById(int entityId);
void Delete(int entityId);
IEnumerable<StockItem> GetAll();
IEnumerable<StockItem> GetByContactId(int contactId);
IEnumerable<StockItem> GetByProcessedJobCardsId(int contactId);
}
}
I get the following runtime error after launching my project and upon hitting the button that runs this process.
 
 
 
I don't know where I went wrong.  Please assist.
 
Answers (1)