Search code examples
c#ormllblgenpro

How does TypedList in LLBLGEN relate to a database?


I have no experience with LLBLGEN. Nevertheless, the company I work for has asked me to use it to do some stuff. They have started me off with this example code

var products = new ProductTypedList();
            using (var adapter = new DataAccessAdapter(_Config.ProductionConnectionString)) {
                var testSkn = "172772";
                var filter = new PredicateExpression(ProductFields.Skn == testSkn);
                 adapter.FetchTypedList(products, filter);
            }

I have used an ORM before in Django, so I am not completely new to this topic. Anyhow, when I run the code, I notice that the product 172772 is returned from our product database, which makes sense. My question is, how does the ProductTypedList know about that database. I haven't been able to find a connection between it and the database anywhere in the code.


Solution

  • A TypedList is one of the types that a View can generate. (You can also map them to Entities). So a ProductTypedList would normally by the result of a Product View in the database.

    The DataAccessAdapter has a parameter that is passing the connection string (that can also be defined in the App or Web.config). Note that the adapter is then used to fetch the TypedList.