コード例 #1
0
 private static ScopeAggregate GetSimpleScope(out IDataAccessAdapter adapter)
 {
     adapter = new DataAccessAdapter();
     var scope = LLBLGenDataScope.Create<LinqMetaData, FunctionMappingStore>(adapter);
     var dep = new ScopeAggregate { DataScope = scope, Session = new object() };
     return dep;
 }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (_filterToUse != null)
     {
         using (DataAccessAdapter adapter = new DataAccessAdapter())
         {
             TerritoryEntity instance = (TerritoryEntity)adapter.FetchNewEntity(new TerritoryEntityFactory(), new RelationPredicateBucket(_filterToUse));
             if (instance != null)
             {
                 laEmployeeTerritories.SetContainingEntity(instance, "EmployeeTerritories");
                 laEmployeesCollectionViaEmployeeTerritories.SetContainingEntity(instance, "EmployeesCollectionViaEmployeeTerritories");
             }
         }
     }
 }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (_filterToUse != null)
     {
         using (DataAccessAdapter adapter = new DataAccessAdapter())
         {
             CategoryEntity instance = (CategoryEntity)adapter.FetchNewEntity(new CategoryEntityFactory(), new RelationPredicateBucket(_filterToUse));
             if (instance != null)
             {
                 laProducts.SetContainingEntity(instance, "Products");
                 laSuppliersCollectionViaProducts.SetContainingEntity(instance, "SuppliersCollectionViaProducts");
             }
         }
     }
 }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (_filterToUse != null)
     {
         using (DataAccessAdapter adapter = new DataAccessAdapter())
         {
             CustomerDemographyEntity instance = (CustomerDemographyEntity)adapter.FetchNewEntity(new CustomerDemographyEntityFactory(), new RelationPredicateBucket(_filterToUse));
             if (instance != null)
             {
                 laCustomerCustomerDemo.SetContainingEntity(instance, "CustomerCustomerDemo");
                 laCustomersCollectionViaCustomerCustomerDemo.SetContainingEntity(instance, "CustomersCollectionViaCustomerCustomerDemo");
             }
         }
     }
 }
コード例 #5
0
        public async Task <IEnumerable <GovernorateEntity> > GetGovernoratesAsync()
        {
            IEnumerable <GovernorateEntity> governorates = null;
            await Task.Run(async() =>
            {
                using (var adapter = new DataAccessAdapter())
                {
                    var metaData = new LinqMetaData(adapter);
                    adapter.CloseConnection();
                    governorates = await metaData.Governorate.ToListAsync();
                }
            });

            return(governorates);
        }
コード例 #6
0
        /// <summary>
        /// Marks the thread as done.
        /// </summary>
        /// <param name="threadId">Thread ID.</param>
        /// <returns></returns>
        public static async Task <bool> MarkThreadAsDoneAsync(int threadId)
        {
            var thread = await ThreadGuiHelper.GetThreadAsync(threadId);

            if (thread == null)
            {
                // not found
                return(false);
            }

            var containingSupportQueue = await SupportQueueGuiHelper.GetQueueOfThreadAsync(threadId);

            thread.MarkedAsDone = true;
            using (var adapter = new DataAccessAdapter())
            {
                // if the thread is in a support queue, the thread has to be removed from that queue. This is a multi-entity action and therefore we've to start a
                // transaction if that's the case. If not, we can use the easy route and simply save the thread and be done with it.
                if (containingSupportQueue == null)
                {
                    // not in a queue, simply save the thread.
                    return(await adapter.SaveEntityAsync(thread).ConfigureAwait(false));
                }

                // in a queue, so remove from the queue and save the entity.
                await adapter.StartTransactionAsync(IsolationLevel.ReadCommitted, "MarkThreadDone").ConfigureAwait(false);

                try
                {
                    // save the thread
                    var result = await adapter.SaveEntityAsync(thread).ConfigureAwait(false);

                    if (result)
                    {
                        // save succeeded, so remove from queue, pass the current adapter to the method so the action takes place inside this transaction.
                        await SupportQueueManager.RemoveThreadFromQueueAsync(threadId, adapter);
                    }

                    adapter.Commit();
                    return(true);
                }
                catch
                {
                    // rollback transaction
                    adapter.Rollback();
                    throw;
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Determines whether the caller is allowed to load the entity instance specified.
        /// </summary>
        /// <param name="entity">The entity instance to be loaded</param>
        /// <returns>true if the caller is allowed to load the entity specified, and false otherwise.</returns>
        public override bool CanLoadEntity(IEntityCore entity)
        {
            // Check the type of the passed in entity
            if (((EntityType)entity.LLBLGenProEntityTypeValue == EntityType.OrdersEntity))
            {
                // The following will execute a query for each Order, which is probably not the most efficient thing to do.
                // This is just used for demo purposes and for authorization proof of concept.
                // You may use prefetchPaths to fetch order details up front with the orders
                // so the calculations can be done in memory, though this requires that the order detail entities are prefetched always.
                // Also you can extend the OrderFactory to add a scalar field for the order total.
                // See: http://weblogs.asp.net/fbouma/archive/2006/06/09/LLBLGen-Pro-v2.0-with-ASP.NET-2.0.aspx
                // for details how to do that.
                DataAccessAdapter adapter       = new DataAccessAdapter();
                object            orderTotalObj = (object)adapter.GetScalar(OrderDetailsFields.OrderId,
                                                                            (OrderDetailsFields.Quantity * OrderDetailsFields.UnitPrice), AggregateFunction.Sum,
                                                                            (OrderDetailsFields.OrderId == ((OrdersEntity)entity).OrderId), new GroupByCollection(OrderDetailsFields.OrderId));

                decimal orderTotal = 0;
                if (orderTotalObj != null)
                {
                    orderTotal = (decimal)orderTotalObj;
                }
                // Only Sales Managers can view Orders with a total sum >= 10,000.
                if (orderTotal >= 10000)
                {
                    if (IsUserInGroup("Sales") && IsUserInGroup("Manager"))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                // Members of the following groups are allowed to load Orders of total sum < 10,000.
                else if (IsUserInGroup("Sales") || IsUserInGroup("Marketing") || IsUserInGroup("Customer Relations"))
                {
                    //Grant
                    return(true);
                }

                //Deny
                return(false);
            }

            // Throw a Security Exception if a wrong entity type is used.
            throw new ORMSecurityException("This Authorizer can't be used with an entity of type " + entity.LLBLGenProEntityName);
        }
コード例 #8
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="suid">The Site UID of the requested entity.</param>
        /// <returns>EntityCollection<ModuleInstanceEntity></returns>
        public static EntityCollection <ModuleInstanceEntity> SelectBySiteUID(System.Int32 suid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleInstanceFields.SiteUID == suid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleInstanceEntity> modulesinstances = new EntityCollection <ModuleInstanceEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(modulesinstances, bucket);
            return(modulesinstances);
        }
コード例 #9
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="name">The name of the requested action entity.</param>
        /// <returns>EntityCollection<ActionEntity></returns>
        public static EntityCollection <ActionEntity> SelectByName(string name)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ActionFields.Name == name);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ActionEntity> actions = new EntityCollection <ActionEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(actions, bucket);
            return(actions);
        }
コード例 #10
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="isbuiltin">The IsBuiltin Flag of the requested entity.</param>
        /// <returns>EntityCollection<ModuleSetEntity></returns>
        public static EntityCollection <ModuleSetEntity> SelectByIsBuiltin(System.Boolean isbuiltin)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleSetFields.IsBuiltIn == isbuiltin);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleSetEntity> mse = new EntityCollection <ModuleSetEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(mse, bucket);
            return(mse);
        }
コード例 #11
0
        public Animal GetById(int id)
        {
            var connectionString = RuntimeConfiguration.GetConnectionString("AnimalContext");

            using var adapter = new DataAccessAdapter(connectionString);
            var metaData = new LinqMetaData(adapter);

            return(metaData.Animal
                   .Where(animal => animal.Id == id)
                   .Select(animal => new Animal
            {
                Id = animal.Id,
                Type = (AnimalType)animal.Type,
                Name = animal.Name
            }).SingleOrDefault());
        }
コード例 #12
0
        public IList <Animal> GetByType(AnimalType type)
        {
            var connectionString = RuntimeConfiguration.GetConnectionString("AnimalContext");

            using var adapter = new DataAccessAdapter(connectionString);
            var metaData = new LinqMetaData(adapter);

            return(metaData.Animal
                   .Where(animal => animal.Type == (int)type)
                   .Select(Animal => new Animal
            {
                Id = Animal.Id,
                Type = (AnimalType)Animal.Type,
                Name = Animal.Name
            }).ToList());
        }
コード例 #13
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="instancesallowed">The Instances Allowed of the requested entity.</param>
        /// <returns>EntityCollection<ModuleSetModuleEntity></returns>
        public static EntityCollection <ModuleSetModuleEntity> SelectByInstancesAllowed(System.Int32 instancesallowed)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleSetModuleFields.InstancesAllowed == instancesallowed);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleSetModuleEntity> mse = new EntityCollection <ModuleSetModuleEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(mse, bucket);
            return(mse);
        }
コード例 #14
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="name">The Name of the requested entity.</param>
        /// <returns>EntityCollection<ModuleSetEntity></returns>
        public static EntityCollection <ModuleSetEntity> SelectByName(System.String name)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleSetFields.Name == name);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleSetEntity> mse = new EntityCollection <ModuleSetEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(mse, bucket);
            return(mse);
        }
コード例 #15
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="edittime">The Edit Time of the requested entity.</param>
        /// <returns>EntityCollection<TemplateEntity></returns>
        public static EntityCollection <TemplateEntity> SelectByEditTime(System.DateTime edittime)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(TemplateFields.EditTime == edittime);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <TemplateEntity> templates = new EntityCollection <TemplateEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(templates, bucket);
            return(templates);
        }
コード例 #16
0
ファイル: SystemManager.cs プロジェクト: alanschrank/HnD
        /// <summary>
        /// Initializes the system, by running a stored procedure passing in the new admin password.
        /// </summary>
        /// <param name="newAdminPassword"></param>
        /// <param name="emailAddress"></param>
        /// <returns></returns>
        public static async Task Initialize(string newAdminPassword, string emailAddress)
        {
            if (string.IsNullOrWhiteSpace(newAdminPassword))
            {
                return;
            }

            var passwordHashed = HnDGeneralUtils.HashPassword(newAdminPassword, performPreMD5Hashing: true);

            using (var adapter = new DataAccessAdapter())
            {
                await ActionProcedures.InstallAsync(emailAddress, passwordHashed, adapter, CancellationToken.None);

                CacheController.PurgeResultsets(CacheKeys.AnonymousUserQueryResultset);
            }
        }
コード例 #17
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="isreadonly">The Is Read Only Flag of the requested entity.</param>
        /// <returns>EntityCollection<ModuleInstanceEntity></returns>
        public static EntityCollection <ModuleInstanceEntity> SelectByIsReadOnly(System.Boolean isreadonly)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleInstanceFields.IsReadOnly == isreadonly);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleInstanceEntity> modulesinstances = new EntityCollection <ModuleInstanceEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(modulesinstances, bucket);
            return(modulesinstances);
        }
コード例 #18
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="nametag">The Name Tag of the requested entity.</param>
        /// <returns>EntityCollection<ModuleInstanceEntity></returns>
        public static EntityCollection <ModuleInstanceEntity> SelectByNameTag(System.String nametag)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleInstanceFields.NameTag == nametag);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleInstanceEntity> modulesinstances = new EntityCollection <ModuleInstanceEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(modulesinstances, bucket);
            return(modulesinstances);
        }
コード例 #19
0
        /// <summary>
        /// This function is used to insert a TemplateChunksEntity in the storage area.
        /// </summary>
        /// <param name="chunkid">Chunk ID</param>
        /// <param name="templateguid">Template GUID</param>
        /// <param name="ispreparsed">Is Preparsed Flag</param>
        /// <param name="htmltext">HTML Text</param>
        /// <param name="chunktype">Chunk Type</param>
        /// <param name="prefix">Prefix</param>
        /// <param name="tagname">TagName</param>
        /// <param name="attributes">Attributes</param>
        /// <returns>True on success, False on fail</returns>
        public static bool Insert(int chunkid, Guid templateguid, bool ispreparsed, string htmltext, byte chunktype, string prefix, string tagname, string attributes)
        {
            TemplateChunksEntity templates = new TemplateChunksEntity();

            templates.ChunkID      = chunkid;
            templates.TemplateGUID = templateguid;
            templates.IsPreParsed  = ispreparsed;
            templates.HTMLText     = htmltext;
            templates.ChunkType    = chunktype;
            templates.Prefix       = prefix;
            templates.TagName      = tagname;
            templates.Attributes   = attributes;
            DataAccessAdapter ds = new DataAccessAdapter();

            return(ds.SaveEntity(templates));
        }
コード例 #20
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="guid">The TemplateGUID of the requested entity.</param>
        /// <returns>EntityCollection<TemplateChunksEntity></returns>
        public static EntityCollection <TemplateChunksEntity> SelectByTemplateGUID(Guid guid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(TemplateChunksFields.TemplateGUID == guid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <TemplateChunksEntity> templatechunks = new EntityCollection <TemplateChunksEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(templatechunks, bucket);
            return(templatechunks);
        }
コード例 #21
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="siteuid">The SiteUID of the requested entity.</param>
        /// <returns>EntityCollection<SiteSubSiteInfoEntity></returns>
        public static EntityCollection <SiteSubSiteInfoEntity> SelectBySiteUID(int siteuid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(SiteSubSiteInfoFields.SiteUID == siteuid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <SiteSubSiteInfoEntity> sitenetinfo = new EntityCollection <SiteSubSiteInfoEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(sitenetinfo, bucket);
            return(sitenetinfo);
        }
コード例 #22
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="name">The Name of the requested entity.</param>
        /// <returns>EntityCollection<SiteTypeEntity></returns>
        public static EntityCollection <SiteTypeEntity> SelectByName(System.String name)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(SiteTypeFields.Name == name);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <SiteTypeEntity> sitestype = new EntityCollection <SiteTypeEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(sitestype, bucket);
            return(sitestype);
        }
コード例 #23
0
        /// <summary>
        /// This function is used to update an SiteSubSiteInfoEntity.
        /// </summary>
        /// <param name="siteuid">Site Unique ID</param>
        /// <param name="currentsubsitecount">The CurrentSubSiteCount of the requested entity.</param>
        /// <param name="maxsubsites">The MaxSubSites of the requested entity.</param>
        /// <returns>True on success, False on fail</returns>
        public static bool Update(
            int siteuid,
            int currentsubsitecount,
            int maxsubsites
            )
        {
            SiteSubSiteInfoEntity siteinfos = new SiteSubSiteInfoEntity(siteuid);

            siteinfos.IsNew               = false;
            siteinfos.SiteUID             = siteuid;
            siteinfos.CurrentSubSiteCount = currentsubsitecount;
            siteinfos.MaxSubSites         = maxsubsites;
            DataAccessAdapter ds = new DataAccessAdapter();

            return(ds.SaveEntity(siteinfos));
        }
コード例 #24
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="etguid">The Entity Type GUID of the requested entity.</param>
        /// <returns>EntityCollection<GroupEntityPermissionEntity></returns>
        public static EntityCollection <GroupEntityPermissionEntity> SelectByEntityTypeGUID(System.Guid etguid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(GroupEntityPermissionFields.EntityTypeGUID == etguid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <GroupEntityPermissionEntity> permissions = new EntityCollection <GroupEntityPermissionEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(permissions, bucket);
            return(permissions);
        }
コード例 #25
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="ouid">The Owner UID of the requested entity.</param>
        /// <returns>EntityCollection<TemplateEntity></returns>
        public static EntityCollection <TemplateEntity> SelectByOwnerUID(System.Int32 ouid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(TemplateFields.OwnerUID == ouid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <TemplateEntity> templates = new EntityCollection <TemplateEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(templates, bucket);
            return(templates);
        }
コード例 #26
0
        public void InsertBatch(IList <EmployeeEntity> employees)
        {
            if (employees == null || employees.Count == 0)
            {
                throw new ArgumentException($"{nameof(employees)} is null or empty.", nameof(employees));
            }

            using (var toInsert = new EntityCollection <EmployeeEntity>(employees))
            {
                using (var adapter = new DataAccessAdapter())
                {
                    adapter.BatchSize = 100;
                    adapter.SaveEntityCollection(toInsert);
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="defguid">The Module Definition GUID of the requested entity.</param>
        /// <returns>EntityCollection<ModuleSetModuleEntity></returns>
        public static EntityCollection <ModuleSetModuleEntity> SelectByModuleDefinitionGUID(System.Guid defguid)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleSetModuleFields.ModuleDefinitionGUID == defguid);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleSetModuleEntity> mse = new EntityCollection <ModuleSetModuleEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(mse, bucket);
            return(mse);
        }
コード例 #28
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="flag">The Is Builtin Flag of the requested entity.</param>
        /// <returns>EntityCollection<TemplateEntity></returns>
        public static EntityCollection <TemplateEntity> SelectByIsBuiltin(System.Boolean flag)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(TemplateFields.IsBuiltin == flag);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <TemplateEntity> templates = new EntityCollection <TemplateEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(templates, bucket);
            return(templates);
        }
コード例 #29
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="allow">The Allow flag of the requested entity.</param>
        /// <returns>EntityCollection<GroupEntityPermissionEntity></returns>
        public static EntityCollection <GroupEntityPermissionEntity> SelectByAllow(System.Boolean allow)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(GroupEntityPermissionFields.Allow == allow);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <GroupEntityPermissionEntity> permissions = new EntityCollection <GroupEntityPermissionEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(permissions, bucket);
            return(permissions);
        }
コード例 #30
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="dt">The Edit Time of the requested entity.</param>
        /// <returns>EntityCollection<ModuleInstanceEntity></returns>
        public static EntityCollection <ModuleInstanceEntity> SelectByEditTime(System.DateTime dt)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(ModuleInstanceFields.EditTime == dt);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <ModuleInstanceEntity> modulesinstances = new EntityCollection <ModuleInstanceEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(modulesinstances, bucket);
            return(modulesinstances);
        }
コード例 #31
0
        /// <summary>
        /// This function is used to query the data source for records.
        /// </summary>
        /// <param name="currentsubsitecount">The CurrentSubSiteCount of the requested entity.</param>
        /// <returns>EntityCollection<SiteSubSiteInfoEntity></returns>
        public static EntityCollection <SiteSubSiteInfoEntity> SelectByCurrentSubSiteCount(int currentsubsitecount)
        {
            PredicateExpression filter = new PredicateExpression();

            filter.Add(SiteSubSiteInfoFields.CurrentSubSiteCount == currentsubsitecount);

            RelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(filter);

            EntityCollection <SiteSubSiteInfoEntity> sitenetinfo = new EntityCollection <SiteSubSiteInfoEntity>();
            DataAccessAdapter ds = new DataAccessAdapter();

            ds.FetchEntityCollection(sitenetinfo, bucket);
            return(sitenetinfo);
        }
        public void Should_perform_in_transaction_with_rollback()
        {
            var service = _container.Resolve<CustomerService>();
           
            //THIS SHOULD HAPPEN IN A TRANSACTION
            _facade.On(service).Invoke(a =>
                                                    {
                                                        a.SetNameToBrodie("CHOPS");
                                                        Assert.AreEqual("Brody", a.Query.Single(b => b.CustomerId == "CHOPS").CompanyName);
                                                    },false);

            // transaction should have rolled back - iow, there should not be any more brody
            var adapter = new DataAccessAdapter();
            var md = new LinqMetaData(adapter);
            
            Assert.AreNotEqual("Brody", md.Customer.Single(b => b.CustomerId == "CHOPS").CompanyName);
        }
コード例 #33
0
        private void SetUpDatabaseConnection()
        {
            DatabaseConnectionString connectionString = new DatabaseConnectionString();

            connectionString.ServerName = "SERVER14";
            connectionString.DatabaseName = "Entrust";
            connectionString.Username = "******";
            connectionString.Password = "******";
            connectionString.UseIntegratedAuthentication = false;

            _adapter = new DataAccessAdapter(connectionString.ToString());
        }