本文整理汇总了C#中BusinessObjectCollection.LoadAll方法的典型用法代码示例。如果您正苦于以下问题:C# BusinessObjectCollection.LoadAll方法的具体用法?C# BusinessObjectCollection.LoadAll怎么用?C# BusinessObjectCollection.LoadAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusinessObjectCollection
的用法示例。
在下文中一共展示了BusinessObjectCollection.LoadAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TearDown
public void TearDown()
{
BusinessObjectCollection<Shape> shapes = new BusinessObjectCollection<Shape>();
shapes.LoadAll();
Shape[] shapesClone = shapes.ToArray();
foreach (Shape shape in shapesClone)
{
shape.MarkForDelete();
}
shapes.SaveAll();
//Shape shape = BOLoader.Instance.GetBusinessObject<Shape>(
// "ShapeName = 'MyShape' OR ShapeName = 'MyShapeChanged'");
//if (shape != null)
//{
// shape.MarkForDelete();
// shape.Save();
//}
//CircleNoPrimaryKey circle = BOLoader.Instance.GetBusinessObject<CircleNoPrimaryKey>(
// "ShapeName = 'Circle' OR ShapeName = 'CircleChanged'");
//if (circle != null)
//{
// circle.MarkForDelete();
// circle.Save();
//}
//FilledCircleInheritsCircleNoPK filledCircle = BOLoader.Instance.GetBusinessObject<FilledCircleInheritsCircleNoPK>(
// "ShapeName = 'FilledCircle' OR ShapeName = 'FilledCircleChanged'");
//if (filledCircle != null)
//{
// filledCircle.MarkForDelete();
// filledCircle.Save();
//}
}
示例2: Test_SaveCar
[Test] // Ensures that a class can be successfully saved
public void Test_SaveCar()
{
CheckIfTestShouldBeIgnored();
//---------------Set up test pack-------------------
Car car = TestUtilsCar.CreateUnsavedValidCar();
//---------------Assert Precondition----------------
Assert.IsTrue(car.Status.IsNew);
BusinessObjectCollection<Car> col = new BusinessObjectCollection<Car>();
col.LoadAll();
Assert.AreEqual(0, col.Count);
//---------------Execute Test ----------------------
car.Save();
//---------------Test Result -----------------------
Assert.IsFalse(car.Status.IsNew);
col.LoadAll();
Assert.AreEqual(1, col.Count);
}
示例3: Test_SaveSteeringWheel
[Test] // Ensures that a class can be successfully saved
public void Test_SaveSteeringWheel()
{
CheckIfTestShouldBeIgnored();
//---------------Set up test pack-------------------
SteeringWheel steeringWheel = TestUtilsSteeringWheel.CreateUnsavedValidSteeringWheel();
//---------------Assert Precondition----------------
Assert.IsTrue(steeringWheel.Status.IsNew);
BusinessObjectCollection<SteeringWheel> col = new BusinessObjectCollection<SteeringWheel>();
col.LoadAll();
Assert.AreEqual(0, col.Count);
//---------------Execute Test ----------------------
steeringWheel.Save();
//---------------Test Result -----------------------
Assert.IsFalse(steeringWheel.Status.IsNew);
col.LoadAll();
Assert.AreEqual(1, col.Count);
}
示例4: Test_SaveVehicle
[Test] // Ensures that a class can be successfully saved
public void Test_SaveVehicle()
{
CheckIfTestShouldBeIgnored();
//---------------Set up test pack-------------------
Vehicle vehicle = TestUtilsVehicle.CreateUnsavedValidVehicle();
//---------------Assert Precondition----------------
Assert.IsTrue(vehicle.Status.IsNew);
BusinessObjectCollection<Vehicle> col = new BusinessObjectCollection<Vehicle>();
col.LoadAll();
Assert.AreEqual(0, col.Count);
//---------------Execute Test ----------------------
vehicle.Save();
//---------------Test Result -----------------------
Assert.IsFalse(vehicle.Status.IsNew);
col.LoadAll();
Assert.AreEqual(1, col.Count);
}
示例5: Test_CreateBusObject
public void Test_CreateBusObject()
{
//---------------Set up test pack-------------------
//ContactPersonTestBO.LoadDefaultClassDef();
BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
cpCol.LoadAll();
RegisterForAddedEvent(cpCol);
//---------------Assert Precondition----------------
Assert.AreEqual(0, cpCol.Count);
Assert.IsFalse(_addedEventFired);
Assert.AreEqual(0, cpCol.PersistedBusinessObjects.Count);
//---------------Execute Test ----------------------
ContactPersonTestBO newCP = cpCol.CreateBusinessObject();
//---------------Test Result -----------------------
AssertOneObjectInCurrentAndCreatedCollection(cpCol);
Assert.Contains(newCP, cpCol.CreatedBusinessObjects);
Assert.Contains(newCP, cpCol);
Assert.IsFalse(cpCol.PersistedBusinessObjects.Contains(newCP));
Assert.IsTrue(_addedEventFired);
}
示例6: TestAcceptanceTransactionLog_DB_DeleteContactPerson
public void TestAcceptanceTransactionLog_DB_DeleteContactPerson()
{
//---------------Set up test pack-------------------
ContactPersonTransactionLogging cp = CreateUnsavedContactPersonTransactionLogging();
TransactionCommitterDB tc = new TransactionCommitterDB(DatabaseConnection.CurrentConnection);
tc.AddBusinessObject(cp);
tc.CommitTransaction();
cp.MarkForDelete();
tc = new TransactionCommitterDB(DatabaseConnection.CurrentConnection);
tc.AddBusinessObject(cp);
//---------------Execute Test ----------------------
tc.CommitTransaction();
//---------------Test Result -----------------------
//Test that a transaction Log was created with
var colTransactions =
new BusinessObjectCollection<TransactionLogBusObj>();
colTransactions.LoadAll("TransactionSequenceNo");
//CRUD = Insert and Dirty XML all properties in DirtyXML.
Assert.IsTrue(colTransactions.Count > 0);
var trLog = colTransactions[colTransactions.Count - 1];
//CRUD = Deleted
Assert.AreEqual("Deleted", trLog.CrudAction);
//---------------Tear Down -------------------------
}
示例7: TestDatabaseReadWrite
public void TestDatabaseReadWrite()
{
// Test inserting & selecting
Shape shape = new Shape {ShapeName = "MyShape"};
shape.Save();
BusinessObjectCollection<Shape> shapes = new BusinessObjectCollection<Shape>();
shapes.LoadAll();
Assert.AreEqual(1, shapes.Count);
BusinessObjectCollection<CircleNoPrimaryKey> circles = new BusinessObjectCollection<CircleNoPrimaryKey>();
circles.LoadAll();
Assert.AreEqual(0, circles.Count);
BusinessObjectCollection<FilledCircleNoPrimaryKey> filledCircles =
new BusinessObjectCollection<FilledCircleNoPrimaryKey>();
filledCircles.LoadAll();
Assert.AreEqual(0, filledCircles.Count);
CircleNoPrimaryKey circle = new CircleNoPrimaryKey {Radius = 5, ShapeName = "Circle"};
circle.Save();
FixtureEnvironment.ClearBusinessObjectManager();
shapes.LoadAll("ShapeName");
Assert.AreEqual(2, shapes.Count);
Assert.AreEqual("Circle", shapes[0].ShapeName);
Assert.AreEqual("MyShape", shapes[1].ShapeName);
FixtureEnvironment.ClearBusinessObjectManager();
circles.LoadAll();
Assert.AreEqual(1, circles.Count);
Assert.AreEqual(circles[0].ShapeID, shapes[0].ShapeID);
Assert.AreEqual(5, circles[0].Radius);
Assert.AreEqual("Circle", circles[0].ShapeName);
FilledCircleNoPrimaryKey filledCircle = new FilledCircleNoPrimaryKey
{
Colour = 3,
Radius = 7,
ShapeName = "FilledCircle"
};
filledCircle.Save();
FixtureEnvironment.ClearBusinessObjectManager();
shapes.LoadAll("ShapeName");
Assert.AreEqual(3, shapes.Count);
Assert.AreEqual("Circle", shapes[0].ShapeName);
Assert.AreEqual("FilledCircle", shapes[1].ShapeName);
Assert.AreEqual("MyShape", shapes[2].ShapeName);
Assert.That(shapes[0], Is.InstanceOf(typeof(CircleNoPrimaryKey)));
Assert.That(shapes[1], Is.InstanceOf(typeof(FilledCircleNoPrimaryKey)));
Assert.That(shapes[2], Is.InstanceOf(typeof(Shape)));
circles.LoadAll("ShapeName");
Assert.AreEqual(2, circles.Count);
Assert.AreEqual(circles[1].ShapeID, shapes[1].ShapeID);
Assert.AreEqual(7, circles[1].Radius);
Assert.AreEqual("FilledCircle", circles[1].ShapeName);
filledCircles.LoadAll();
Assert.AreEqual(1, filledCircles.Count);
Assert.AreEqual(filledCircles[0].ShapeID, shapes[1].ShapeID);
Assert.AreEqual(7, filledCircles[0].Radius);
Assert.AreEqual("FilledCircle", filledCircles[0].ShapeName);
Assert.AreEqual(3, filledCircles[0].Colour);
// Test updating
shape.ShapeName = "MyShapeChanged";
shape.Save();
circle.ShapeName = "CircleChanged";
circle.Radius = 10;
circle.Save();
filledCircle.ShapeName = "FilledCircleChanged";
filledCircle.Radius = 12;
filledCircle.Colour = 4;
filledCircle.Save();
shapes.LoadAll("ShapeName");
Assert.AreEqual("CircleChanged", shapes[0].ShapeName);
Assert.AreEqual("FilledCircleChanged", shapes[1].ShapeName);
Assert.AreEqual("MyShapeChanged", shapes[2].ShapeName);
circles.LoadAll("ShapeName");
Assert.AreEqual(10, circles[0].Radius);
Assert.AreEqual(12, circles[1].Radius);
Assert.AreEqual("CircleChanged", circles[0].ShapeName);
Assert.AreEqual("FilledCircleChanged", circles[1].ShapeName);
filledCircles.LoadAll();
Assert.AreEqual(4, filledCircles[0].Colour);
Assert.AreEqual(12, filledCircles[0].Radius);
Assert.AreEqual("FilledCircleChanged", filledCircles[0].ShapeName);
// Test deleting
shape.MarkForDelete();
shape.Save();
circle.MarkForDelete();
circle.Save();
filledCircle.MarkForDelete();
filledCircle.Save();
//.........这里部分代码省略.........
示例8: TestSetupComboBoxFromClassDef_SetsItemsInComboBox
public void TestSetupComboBoxFromClassDef_SetsItemsInComboBox()
{
//---------------Set up test pack-------------------
IClassDef classDef = ContactPersonTestBO.LoadClassDefOrganisationTestBORelationship_MultipleReverse();
OrganisationTestBO.LoadDefaultClassDef();
ContactPerson.DeleteAllContactPeople();
OrganisationTestBO.ClearAllFromDB();
OrganisationTestBO.CreateSavedOrganisation();
OrganisationTestBO.CreateSavedOrganisation();
ContactPersonTestBO.CreateSavedContactPersonNoAddresses();
TestUtil.WaitForGC();
BusinessObjectCollection<ContactPersonTestBO> col = new BusinessObjectCollection<ContactPersonTestBO>();
col.LoadAll();
IEditableGridControl gridControl = GetControlFactory().CreateEditableGridControl();
GridInitialiser gridInitialiser = new GridInitialiser(gridControl, GetControlFactory());
//--------------Assert PreConditions----------------
Assert.AreEqual(0, gridControl.Grid.Columns.Count);
Assert.AreEqual(1, classDef.UIDefCol.Count);
const string uiDefName = "default";
IUIGrid uiGridDef = classDef.UIDefCol[uiDefName].UIGrid;
Assert.IsNotNull(uiGridDef);
Assert.AreEqual(1, uiGridDef.Count);
Assert.AreEqual(1, col.Count);
Assert.AreEqual(2,
BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObjectCollection<OrganisationTestBO>
("").Count);
//---------------Execute Test ----------------------
gridInitialiser.InitialiseGrid(classDef, uiDefName);
//---------------Test Result -----------------------
Assert.AreEqual(2, gridControl.Grid.Columns.Count, "Should have ID column and should have comboBoxColumn");
IDataGridViewColumn dataGridViewColumn = gridControl.Grid.Columns[1];
AssertIsComboBoxColumnType(dataGridViewColumn);
AssertComboBoxItemCount(dataGridViewColumn, 3);
}
示例9: TestLoadUpdatedShapes
public void TestLoadUpdatedShapes()
{
//-------------Setup Test Pack ------------------
Shape shape = CreateSavedShape();
CircleNoPrimaryKey circle = CreateSavedCircle();
FilledCircleInheritsCircleNoPK filledCircle = CreateSavedFilledCircle();
shape.ShapeName = "MyShapeChanged";
shape.Save();
circle.ShapeName = "CircleChanged";
circle.Radius = 10;
circle.Save();
filledCircle.ShapeName = "FilledCircleChanged";
filledCircle.Radius = 12;
filledCircle.Colour = 4;
filledCircle.Save();
//-------------Execute test ---------------------
BusinessObjectCollection<Shape> shapes = new BusinessObjectCollection<Shape>();
BusinessObjectCollection<CircleNoPrimaryKey> circles = new BusinessObjectCollection<CircleNoPrimaryKey>();
BusinessObjectCollection<FilledCircleInheritsCircleNoPK> filledCircles =
new BusinessObjectCollection<FilledCircleInheritsCircleNoPK>();
shapes.LoadAll("ShapeName");
circles.LoadAll("ShapeName");
filledCircles.LoadAll("ShapeName");
//-------------Test Result ----------------------
Assert.AreEqual(3, shapes.Count);
Assert.AreEqual("CircleChanged", shapes[0].ShapeName);
Assert.AreEqual("FilledCircleChanged", shapes[1].ShapeName);
Assert.AreEqual("MyShapeChanged", shapes[2].ShapeName);
Assert.AreEqual(2, circles.Count);
Assert.AreEqual(10, circles[0].Radius);
Assert.AreEqual(12, circles[1].Radius);
Assert.AreEqual("CircleChanged", circles[0].ShapeName);
Assert.AreEqual("FilledCircleChanged", circles[1].ShapeName);
Assert.AreEqual(1, filledCircles.Count);
Assert.AreEqual(4, filledCircles[0].Colour);
Assert.AreEqual(12, filledCircles[0].Radius);
Assert.AreEqual("FilledCircleChanged", filledCircles[0].ShapeName);
}
示例10: Test_CreateDisplayValueDictionary_NoSort
public void Test_CreateDisplayValueDictionary_NoSort()
{
//--------------- Set up test pack ------------------
ClassDef.ClassDefs.Clear();
MyBO.LoadDefaultClassDef();
MyBO.DeleteAllMyBos();
FixtureEnvironment.ClearBusinessObjectManager();
TestUtil.WaitForGC();
MyBO myBO1 = new MyBO();
myBO1.Save();
MyBO myBO2 = new MyBO();
myBO2.Save();
MyBO myBO3 = new MyBO();
myBO3.Save();
BusinessObjectCollection<MyBO> myBOs = new BusinessObjectCollection<MyBO>();
myBOs.LoadAll();
//--------------- Test Preconditions ----------------
//--------------- Execute Test ----------------------
Dictionary<string, string> dictionary = BusinessObjectLookupList.CreateDisplayValueDictionary(myBOs, false, Convert.ToString);
//--------------- Test Result -----------------------
Assert.AreEqual(3, dictionary.Count);
Assert.IsTrue(dictionary.ContainsValue(myBO1.ID.ToString()));
Assert.IsTrue(dictionary.ContainsValue(myBO2.ID.ToString()));
Assert.IsTrue(dictionary.ContainsValue(myBO3.ID.ToString()));
}
示例11: CreateSavedMyBoCollection
protected static BusinessObjectCollection<MyBO> CreateSavedMyBoCollection()
{
CreateSavedMyBo();
CreateSavedMyBo();
BusinessObjectCollection<MyBO> myBos = new BusinessObjectCollection<MyBO>();
myBos.LoadAll("");
return myBos;
}
示例12: TestDatabaseReadWrite
public void TestDatabaseReadWrite()
{
// Test inserting & selecting
Shape shape = new Shape();
shape.ShapeName = "MyShape";
shape.Save();
BusinessObjectCollection<Shape> shapes = new BusinessObjectCollection<Shape>();
shapes.LoadAll();
Assert.AreEqual(1, shapes.Count);
BusinessObjectCollection<Circle> circles = new BusinessObjectCollection<Circle>();
circles.LoadAll();
Assert.AreEqual(0, circles.Count);
Circle circle = new Circle();
circle.Radius = 5;
circle.ShapeName = "Circle";
circle.Save();
shapes.LoadAll("ShapeName");
Assert.AreEqual(2, shapes.Count);
Assert.AreEqual("Circle", shapes[0].ShapeName);
Assert.AreEqual("MyShape", shapes[1].ShapeName);
circles.LoadAll();
Assert.AreEqual(1, circles.Count);
Assert.AreEqual(circles[0].CircleID, shapes[0].ShapeID);
Assert.AreEqual(circles[0].ShapeID, shapes[0].ShapeID); //still gets inherited
Assert.AreEqual(5, circles[0].Radius);
Assert.AreEqual("Circle", circles[0].ShapeName);
// Test updating
shape.ShapeName = "MyShapeChanged";
shape.Save();
circle.ShapeName = "CircleChanged";
circle.Radius = 10;
circle.Save();
shapes.LoadAll("ShapeName");
Assert.AreEqual("CircleChanged", shapes[0].ShapeName);
Assert.AreEqual("MyShapeChanged", shapes[1].ShapeName);
circles.LoadAll();
Assert.AreEqual(10, circles[0].Radius);
Assert.AreEqual("CircleChanged", circles[0].ShapeName);
// Test deleting
shape.MarkForDelete();
shape.Save();
circle.MarkForDelete();
circle.Save();
shapes.LoadAll();
Assert.AreEqual(0, shapes.Count);
circles.LoadAll();
Assert.AreEqual(0, circles.Count);
}
示例13: PopulateCollectionAsync_WithCallback_RespectsSynchronousGlobalHint
public void PopulateCollectionAsync_WithCallback_RespectsSynchronousGlobalHint()
{
//---------------Set up test pack-------------------
GlobalUIRegistry.AsyncSettings.SynchroniseBackgroundOperations = true;
IClassDef classDef = ContactPersonTestBO.LoadDefaultClassDefWithUIDef();
ContactPersonTestBO boExclude = new ContactPersonTestBO {Surname = "Excude this one."};
boExclude.Save();
new ContactPersonTestBO {Surname = "Include this one."}.Save();
IReadOnlyGridControl grid = CreateReadOnlyGridControl(true);
grid.AdditionalSearchCriteria = "Surname <> '" + boExclude.Surname + "'";
grid.Initialise(classDef);
grid.FilterControl.Visible = true;
grid.FilterMode = FilterModes.Filter;
BusinessObjectCollection<ContactPersonTestBO> col = new BusinessObjectCollection<ContactPersonTestBO>();
col.LoadAll();
var afterPopCalled = false;
//---------------Assert Precondition----------------
//---------------Execute Test ----------------------
grid.PopulateCollectionAsync(() => { Thread.Sleep(100); return col; }, () => { afterPopCalled = true; });
//---------------Test Result -----------------------
Assert.IsNotNull(grid.BusinessObjectCollection);
Assert.IsTrue(afterPopCalled);
}
示例14: Test_FilterGrid_AppliesAdditionalSearchCriteria_NoFilterCriteria
public void Test_FilterGrid_AppliesAdditionalSearchCriteria_NoFilterCriteria()
{
//---------------Set up test pack-------------------
IClassDef classDef = ContactPersonTestBO.LoadDefaultClassDefWithUIDef();
ContactPersonTestBO boExclude = new ContactPersonTestBO {Surname = "Excude this one."};
boExclude.Save();
new ContactPersonTestBO {Surname = "Include this one."}.Save();
IReadOnlyGridControl grid = CreateReadOnlyGridControl(true);
grid.AdditionalSearchCriteria = "Surname <> '" + boExclude.Surname + "'";
grid.Initialise(classDef);
grid.FilterControl.Visible = true;
grid.FilterMode = FilterModes.Filter;
BusinessObjectCollection<ContactPersonTestBO> col = new BusinessObjectCollection<ContactPersonTestBO>();
col.LoadAll();
grid.BusinessObjectCollection = col;
//---------------Execute Test ----------------------
grid.FilterControl.ApplyFilter();
//---------------Test Result -----------------------
Assert.AreEqual(col.Count - 1, grid.Grid.Rows.Count, "The additional filter should exclude " + boExclude.ID);
}
示例15: Test_SearchGrid_AppliesAdditionalSearchCriteria_NoFilterCriteria
public void Test_SearchGrid_AppliesAdditionalSearchCriteria_NoFilterCriteria()
{
//---------------Set up test pack-------------------
IClassDef classDef = ContactPersonTestBO.LoadDefaultClassDefWithUIDef();
ContactPersonTestBO boExclude = new ContactPersonTestBO();
boExclude.Surname = "Excude this one.";
boExclude.Save();
ContactPersonTestBO boInclude = new ContactPersonTestBO();
boInclude.Surname = "Include this one.";
boInclude.Save();
IReadOnlyGridControl grid = CreateReadOnlyGridControl(true);
grid.AdditionalSearchCriteria = "ContactPersonID <> " + boExclude.ContactPersonID.ToString("B");
grid.Initialise(classDef);
grid.FilterControl.Visible = true;
grid.FilterMode = FilterModes.Search;
BusinessObjectCollection<ContactPersonTestBO> col = new BusinessObjectCollection<ContactPersonTestBO>();
col.LoadAll();
//---------------Execute Test ----------------------
grid.FilterControl.FilterButton.PerformClick();
//---------------Test Result -----------------------
Assert.AreEqual(col.Count - 1, grid.Grid.Rows.Count, "The additional filter should exclude " + boExclude.ID);
}