public class Person { public int Id { get; set; } public string Name { get; set; } public string Address { get; set; } } public static void Main(string[] args) { Person newPerson = CreateEntity(); newPerson.Id = 1; newPerson.Name = "John Smith"; newPerson.Address = "123 Main St."; } public static T CreateEntity () where T : new() { return new T(); }
using Microsoft.Xrm.Sdk; public static void Main(string[] args) { Entity newEntity = CreateEntityIn this example, the `CreateEntity` method is used to create a new instance of the `Entity` class from the Dynamics 365 SDK. The `LogicalName` property is set to "account" to indicate that this entity represents a company account. The `name` attribute is then set to "Acme Corp". The `Microsoft.Xrm.Sdk` package is used to access the `Entity` class.(); newEntity.LogicalName = "account"; newEntity["name"] = "Acme Corp"; } public static T CreateEntity () where T : Entity, new() { return new T(); }