private void InitInfrastructureServices() { try { // Cargar todos los modelos de datos y verificar ensamblados DataModelDataAccess dataModelDataAccess = new DataModelDataAccess(); Collection <DataModelEntity> result = dataModelDataAccess.LoadWhere(DataModelEntity.DBIdStore, "0", false, OperatorType.Equal); dataModelDataAccess = new DataModelDataAccess(); Collection <DataModelEntity> dataModels = dataModelDataAccess.LoadAll(true); if (result.Count == 0) { ConsoleWriter.SetText("Creating mall data model"); DataModelEntity dataModel = new DataModelEntity(); MallEntity mall = new MallEntity(); mall.MallName = "Mall"; (new MallDataAccess()).Save(mall); dataModel.Mall = mall; dataModelDataAccess.Save(dataModel); } foreach (DataModelEntity dataModel in dataModels) { string assemblyFileName = dataModel.ServiceAssemblyFileName; if (assemblyFileName != null) { if (File.Exists(Path.Combine(ServiceBuilder.AssembliesFolder, assemblyFileName))) { Type[] servicesTypes = ServiceBuilder.GetInfrastructureServiceTypes(assemblyFileName); Binding serviceBinding = new BasicHttpBinding(); if (PublishInfrastructureService(servicesTypes[0], servicesTypes[1], serviceBinding)) { Debug.WriteLine("SUCCESS : infrastructure service published."); } else { Debug.WriteLine("FAILURE : trying to publish infrastructure service."); } } else { ServiceBuilder builder = new ServiceBuilder(); dataModel.Deployed = false; builder.BuildAndImplementInfrastructureService(dataModel, false, serverSession); } } } } catch (DataException dataError) { Debug.WriteLine("ERROR : Data exception running infrastructure services. MESSAGE : " + dataError.Message); } catch (IOException ioError) { Debug.WriteLine("ERROR : IO error running infrastructure services. MESSAGE : " + ioError.Message); } }