示例#1
0
        private OmniaEntityWrapper(OmniaClient omniaClient, EntityMetadata entityMetadata)
        {
            _omniaClient    = omniaClient;
            _entityMetadata = entityMetadata;

            _presentationEntity = Activator.CreateInstance <T>();
            _synchronizedEntity = Activator.CreateInstance <T>();
        }
示例#2
0
        public static async Task <OmniaEntityWrapper <T> > Create(OmniaClient omniaClient, EntityMetadata entityMetadata, string code = null)
        {
            var entityWrapper = new OmniaEntityWrapper <T>(omniaClient, entityMetadata);

            if (string.IsNullOrEmpty(code))
            {
                var temporary = await omniaClient.CreateTemporary(entityMetadata);

                entityWrapper.ApplyInitialJsonPatchDocument(temporary.id, temporary.data);
            }
            else
            {
                var temporary = await omniaClient.CreateTemporary <T>(entityMetadata, code);

                entityWrapper.ApplyInitialDocument(temporary.id, temporary.data);
            }

            return(entityWrapper);
        }