Exemplo n.º 1
0
        private void TextOrm()
        {
            //_hepler.VeryfiyRepair();

            DependencyObject entity = (DependencyObject)this._helper.Create(Product.DefaultType);

            entity[0] = Guid.NewGuid().ToString();
            entity[1] = "001";
            entity[2] = "CPU";
            //this._helper.Save(entity);

            QueryNode node = OOQL.Select("CODE", "NAME")
                             .From("Product")
                             .Where(OOQL.CreateProperty("ID") == OOQL.CreateConstants("3DE1E070-241C-42BE-8704-AC46140CCE09"));
            IQueryBuilder builder = OrmEntry.CreateQuery(_helper.DBSource, _helper.DBDriver);
            string        str     = builder.Select("Product", new string[] { "CODE", "NAME" }, null, null);

            Digiwin.Common.Torridity.Query.QueryEntity queryEn = new Digiwin.Common.Torridity.Query.QueryEntity("Product");

            //DataSet ds = builder.ExecuteSelect(new Digiwin.Common.Torridity.Query.QueryEntity[] { queryEn });

            Product p = new Product(((DependencyObject)Product.DefaultType.CreateInstance()));

            p.ID   = Guid.NewGuid();
            p.CODE = "222";
            this._helper.Save(p.DependencyObject);
        }
Exemplo n.º 2
0
        public void Delete(IDataEntityType entityType, object oid)
        {
            IDocumentService service = OrmEntry.CreateDocumentService(entityType, this.DBDriver) as IDocumentService;

            if (service != null)
            {
                service.Delete(oid);
            }
        }
Exemplo n.º 3
0
        public object Read(IDataEntityType entityType, object oid)
        {
            IDocumentService service = OrmEntry.CreateDocumentService(entityType, this.DBDriver) as IDocumentService;

            if (service != null)
            {
                return(service.Read(oid));
            }
            return(null);
        }
Exemplo n.º 4
0
 public ORMHelper()
 {
     DBSource = OrmEntry.CreateDBSource();
     //注册主实体定义
     DBSource.DataEntityTypes.Add(Customer.DefaultType);
     DBSource.DataEntityTypes.Add(Product.DefaultType);
     DBSource.DataEntityTypes.Add(Quotation.DefaultType);
     //添加数据库驱动
     this.DBDriver = new SqlServerDriver();
     this.DBDriver.ConnectionString = ConnectionString;
 }
Exemplo n.º 5
0
        public void Save(DependencyObject entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            IDocumentService service = OrmEntry.CreateDocumentService(entity.GetDataEntityType(), this.DBDriver) as IDocumentService;

            if (service != null)
            {
                service.Save(entity);
            }
        }