Skip to content
Discussion options

You must be logged in to vote

I think this is probably the right answer?

using Csla;
using Csla.Configuration;
using Csla.Core;
using Csla.Rules;
using Microsoft.Extensions.DependencyInjection;

// configuration

var services = new ServiceCollection();
services.AddCsla();
var provider = services.BuildServiceProvider();

// test code

var dp = provider.GetRequiredService<IDataPortal<EquipmentDelete>>();
var equipment = dp.Fetch(42);
try
{
  var deleted = await equipment.RemoveEquipment();
  if (deleted)
  {
    Console.WriteLine("Deleted successfully");
  }
  else
  {
    Console.WriteLine(equipment.BrokenRulesCollection.GetFirstBrokenRule(EquipmentDelete.IdProperty).Description);
  }
}
catch (DataPortalException ex)
{
  

Replies: 9 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@rockfordlhotka
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@rockfordlhotka
Comment options

Answer selected by jhuerta3
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jhuerta3
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants