예제 #1
0
 private string GetOperationReturnType(IOperationModel o)
 {
     if (o.ReturnType == null)
     {
         return(o.IsAsync() ? "async Task" : "void");
     }
     return(o.IsAsync() ? $"async Task<{GetTypeName(o.ReturnType.TypeReference)}>" : GetTypeName(o.ReturnType.TypeReference));
 }
예제 #2
0
        public string GetImplementation(IMetaDataManager metaDataManager, SoftwareFactory.Engine.IApplication application, IClass domainModel, IOperationModel operationModel)
        {
            var idParam  = operationModel.Parameters.First(p => string.Equals(p.Name, "id", StringComparison.OrdinalIgnoreCase));
            var dtoParam = operationModel.Parameters.First(p => !string.Equals(p.Name, "id", StringComparison.OrdinalIgnoreCase));

            return($@"var existing{domainModel.Name} ={ (operationModel.IsAsync() ? " await" : "") } {domainModel.Name.ToPrivateMember()}Repository.FindById{ (operationModel.IsAsync() ? "Async" : "") }({idParam.Name});
                {EmitPropertyAssignments(metaDataManager, application, domainModel, "existing"+ domainModel.Name, dtoParam)}");
        }
예제 #3
0
 public override string AfterCallToAppLayer(IServiceModel service, IOperationModel operation)
 {
     if (operation.Stereotypes.Any(x => x.Name == "ReadOnly"))
     {
         return("");
     }
     return(operation.IsAsync()
         ? $@"
             await _dbContext.SaveChangesAsync();"
         : $@"
             _dbContext.SaveChanges();");
 }
 public string GetImplementation(IMetaDataManager metaDataManager, SoftwareFactory.Engine.IApplication application, IClass domainModel, IOperationModel operationModel)
 {
     return($@"var existing{domainModel.Name} ={ (operationModel.IsAsync() ? " await" : "") } {domainModel.Name.ToPrivateMember()}Repository.FindById{ (operationModel.IsAsync() ? "Async" : "") }(id);
         {domainModel.Name.ToPrivateMember()}Repository.Remove(existing{domainModel.Name});");
 }
 public string GetImplementation(IMetaDataManager metaDataManager, SoftwareFactory.Engine.IApplication application, IClass domainModel, IOperationModel operationModel)
 {
     return($@"var elements ={ (operationModel.IsAsync() ? "await" : "") } {domainModel.Name.ToPrivateMember()}Repository.FindAll{ (operationModel.IsAsync() ? "Async" : "") }();
     return elements.MapTo{domainModel.Name.ToPascalCase()}DTOs();");
 }