How to Expose Class Types from a Component within a DLL

  .net-framework-4.8, c++, dll, types, windows

I am using a component from a company called Devart. This component produces a data model very much like Entity Framework except it is for SQLite. I have my data models and data context, etc very similar to the way Entity Framework works.

I created a Windows .NetFramework DLL Class Library that I will use to handle many of my database related activities. Within this DLL I have my data models and data context which of course contain all of my table class types etc.

Inside my DLL I can write the following code:

   public dbSales.tbl_Customers GetCustomer_byCustomerID(int _customerID)
   {
          dbSales.tbl_Customers selectedCustomer = (from dbContext.tbl_Customers 
                                                    where i.CustID == _customerID 
                                                     Select i).FirstOrDefault();
   }

Then in my other program I want to reference the DLL and that method to retrieve data. I do not know how to expose the types for my tables so that I can do the following: my DLL contains a class called DataHelper.

(The code is written in expanded form for clarity)

DataHandler.DataHelper.tbl_Customers selectedCustomer = new DataHandler.DataHelper.tbl_Customers();
selectedCustomer = DataHandler.DataHelper.GetCustomer_byCustomerID(45);

I do not know how to expose the type: tbl_Customers. It is simply my ignorance. The only work around I have found is to do the following using var. I like to be able to specify my types though and do not like using var. The following works:

var selectedCustomer = DataHandler.DataHelper.GetCustomer_byCustomerID(45);

I’ve tried making different things public such as the model, or the context, etc. But still it is as if I am only exposing methods and properties. I am simply ignorant about types and how to work with them. I honestly would like to find a good book that explains types and how to work with them.

If anyone can provide assistance with this, it would be greatly appreciated.

Source: Windows Questions

LEAVE A COMMENT