This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Program | |
| { | |
| internal static void ChangeValue(SampleClass instance, string value) | |
| { | |
| instance.Value = value; | |
| } | |
| internal static void ChangeValue(ref SampleClass instance, string value) | |
| { | |
| instance.Value = value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SampleClass | |
| { | |
| public SampleClass(string value) | |
| { | |
| this.Value = value; | |
| } | |
| public string Value { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class WebApiConfig | |
| { | |
| public static void Register(HttpConfiguration config) | |
| { | |
| //Default OData version is 4.0 | |
| ODataConventionModelBuilder modelBuilder = new ODataConventionModelBuilder(); | |
| config.Count().Filter().OrderBy().Expand().Select().MaxTop(500); | |
| modelBuilder.EntitySet("items"); | |
| config.MapODataServiceRoute("items", "odata", modelBuilder.GetEdmModel()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ItemsController : ODataController | |
| { | |
| private readonly IItemsRepository itemsRepository;</code> | |
| public ItemsController(IItemsRepository itemsRepository) | |
| { | |
| this.itemsRepository = itemsRepository; | |
| } | |
| [EnableQuery] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Guid ToGuid(int value) | |
| { | |
| byte[] bytes = new byte[16]; | |
| BitConverter.GetBytes(value).CopyTo(bytes, 0); | |
| return new Guid(bytes); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void RunImport() | |
| { | |
| List<Subject> subjects = this.unitOfWork.SubjectsRepository.GetAll(); //Getting data from the document db | |
| ImportSubjects(subjects, null); //Import data to Dynamics 365 instance | |
| } | |
| public void ImportSubjects(List<Subject> subjects, Guid? parentSubject) | |
| { | |
| var subjectsToBeImported = subjects.Where<Subject>(s => s.ParentSubject?.Id == parentSubject).ToList<Subject>(); | |
| subjectsToBeImported.ForEach(s => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "_id" : LUUID("4d6c1fce-d035-11e7-a82a-000d3a2a3caf"), | |
| "LogicalName" : "subject", | |
| "Attributes" : [ | |
| { | |
| "k" : "modifiedby", | |
| "v" : { | |
| "_t" : "EntityReference", | |
| "_id" : LUUID("45bf6873-9e6a-ac4e-af72-dda713ccf2a5"), | |
| "LogicalName" : "systemuser", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SubjectsRepository : DocumentDbRepositoryBase, IDocDbSubjectsRepository | |
| { | |
| readonly IMongoCollection<Subject> dataCollection; | |
| public SubjectsRepository(IMongoDatabase documentDb) : base(documentDb) | |
| { | |
| this.dataCollection = documentDb.GetCollection<Subject>("Subject"); | |
| } | |
| public List<Subject> GetAll() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <reference path="../XRM/Form/account/Main/Information.d.ts" /> | |
| /// <reference path="../common/DataServices.ts" /> | |
| module Foo.Dyn365.Account { | |
| export class EventHandlers { | |
| static onLoad(): void { | |
| console.log("onLoad invoked from Account"); | |
| let dataService = new Foo.Dyn365.DataServices.OpportunityDataService(); | |
| let form = new Form(dataService); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <reference path="../Xrm/Form/account/Main/Information.d.ts" /> | |
| module Foo.Dyn365.Common { | |
| declare var Xrm; | |
| export class Form { | |
| constructor() { | |
| } |