コード例 #1
0
 public DataViewRemote(DataAdapter dataAdapter, DataContext dataContext, MetadataCli.Metadata metadataCli)
 {
     this.entityTypeName = typeof(T).Name;
     this.dataAdapter    = dataAdapter;
     this.dataContext    = dataContext;
     this.metadataCli    = metadataCli;
 }
コード例 #2
0
        public DataAdapter(string baseUrl, string apiUrl, MetadataCli.Metadata metadataCli)
        {
            this.client             = new HttpClient();
            this.client.BaseAddress = new Uri(baseUrl);
            this.client.DefaultRequestHeaders.Accept.Clear();
            this.client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            this.apiUrl      = apiUrl;
            this.metadataCli = metadataCli;
        }
コード例 #3
0
 public DataService(string baseUrl, string apiUrl, MetadataCli.Metadata metadataCli) : base(baseUrl, apiUrl, metadataCli)
 {
     this.From = new ServiceLocation <LocalViews, RemoteViews>()
     {
         Local = new LocalViews(this.DataContext), Remote = new RemoteViews(this.DataAdapter, this.DataContext, metadataCli)
     };
     this.Operation = new ServiceOperation <ServiceFunctions, ServiceActions>()
     {
         Function = new ServiceFunctions(this.DataAdapter, this.DataContext), Action = new ServiceActions(this.DataAdapter, this.DataContext)
     };
 }
コード例 #4
0
 public void Dispose()
 {
     // se va apela inainte de incetarea utilizarii obiectului
     // pentru a evita aparitia de memory leaks si a usura activitatea GC-ului
     foreach (var entitySet in this.entitySets)
     {
         var entitySetValue = entitySet.Value;
         entitySetValue.Dispose();
     }
     this.entitySets  = null;
     this.metadataCli = null;
 }
コード例 #5
0
 public void Detach()
 {
     this.entitySets  = null;
     this.metadataCli = null;
 }
コード例 #6
0
 public void Attach(Dictionary <string, IEntitySet <IDerivedEntity> > entitySets, MetadataCli.Metadata metadataCli)
 {
     this.entitySets  = entitySets;
     this.metadataCli = metadataCli;
 }
コード例 #7
0
 public DataContext(string @namespace, MetadataCli.Metadata metadataCli)
 {
     this.metadataCli = metadataCli;
     this.@namespace  = @namespace;
     this.entitySets  = new Dictionary <string, IEntitySet <IDerivedEntity> >();
 }
コード例 #8
0
 protected DataServiceBase(string baseUrl, string apiUrl, MetadataCli.Metadata metadataCli)
 {
     this.DataAdapter = new DataAdapter(baseUrl, apiUrl, metadataCli);
     this.DataContext = new DataContext("Client.Modules.Utils.DAL", metadataCli);
 }
コード例 #9
0
        /*
         */
        public static IEntitySet <IDerivedEntity> CreateEntitySet(string entityTypeName, Dictionary <string, IEntitySet <IDerivedEntity> > entitySets, string @namespace, MetadataCli.Metadata metadataCli)
        {
            var derivedEntityType = Type.GetType(@namespace + "." + entityTypeName);
            var d1          = typeof(EntitySet <>);
            var typeArgs    = new Type[] { derivedEntityType };
            var constructed = d1.MakeGenericType(typeArgs);
            var entitySet   = Activator.CreateInstance(constructed, new object[] { derivedEntityType, entitySets, metadataCli });

            return((IEntitySet <IDerivedEntity>)entitySet);
        }
コード例 #10
0
 public void Dispose()
 {
     this.DeleteAll();
     this.entitySets  = null;
     this.metadataCli = null;
 }
コード例 #11
0
 public EntitySet(Type derivedEntityType, Dictionary <string, IEntitySet <IDerivedEntity> > entitySets, MetadataCli.Metadata metadataCli)
 {
     this.derivedEntityType = derivedEntityType;
     this.entityTypeName    = derivedEntityType.Name;
     this.entitySets        = entitySets;
     this.metadataCli       = metadataCli;
     this.key   = metadataCli.EntityTypes[this.entityTypeName].Key;
     this.Items = new List <IDerivedEntity>();
 }
コード例 #12
0
 public RemoteViews(DataAdapter dataAdapter, DataContext dataContext, MetadataCli.Metadata metadataCli) : base(dataAdapter, dataContext, metadataCli)
 {
 }