main.cs2284 chars77 lines
The above code uses the Entity Framework to split the "Sku" column using slashes and saves the result to the database. It also sends an email complaining afterward.
The code retrieves all products from the database and then loops through each one. It splits the "Sku" column using the slashes, and then assigns the resulting parts to additional properties on the object. These new properties are then marked as modified in the Entity Framework so that the changes will be persisted to the database when SaveChanges
is called.
Finally, the SendEmail
method sends an email using the SMTP client provided with .NET.
gistlibby LogSnag