In my previous 2 articles (Create SharePoint 2013 External List using Visual Studio 2012, Extending External List Capabilities to Add and Edit List Items) I described how to create an External Content Type and create a list using that content type.
In this article the focus will be on creating the list using C# rather using the SharePoint UI. Given the BDC Model goes in a farm level feature and create the external content type, the best option would have been writing the list creation code in the FeatureActivated method of the feature receiver. There are some issues I faced when creating this list. Given the BDC model deployment also associated with a feature receiver that is not visible, this was not possible to create a feature receiver for the feature that included the BDC model. There were some possible scenarios explained in some articles, but I did not follow them since there is another cleaner approach.
Therefore I created another feature and added a feature receiver for the second feature. The feature activation procedure needs to be done in an order. The second feature needed to be activated after the deployment of the first feature as the External Content Type needed to be presented before creating the list.