本文整理汇总了C#中Builder类的典型用法代码示例。如果您正苦于以下问题:C# Builder类的具体用法?C# Builder怎么用?C# Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Builder类属于命名空间,在下文中一共展示了Builder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PlayGamesClientConfiguration
private PlayGamesClientConfiguration(Builder builder)
{
this.mEnableSavedGames = builder.HasEnableSaveGames();
this.mEnableDeprecatedCloudSave = builder.HasEnableDeprecatedCloudSave();
this.mInvitationDelegate = builder.GetInvitationDelegate();
this.mMatchDelegate = builder.GetMatchDelegate();
}
开发者ID:nickhester,项目名称:SocialNetwork,代码行数:7,代码来源:PlayGamesClientConfiguration.cs
示例2: ExtendedThreadPool
private ExtendedThreadPool(Builder builder)
{
Name = builder.Name;
SetThreadingRange(builder);
MultiThreadingCapacity = builder.MultiThreadingCapacity;
_taskQueueController = builder.TaskQueueController;
}
开发者ID:KaterinaShumskaya,项目名称:Nelibur,代码行数:7,代码来源:ExtendedThreadPool.cs
示例3: PlayGamesClientConfiguration
/// <summary>
/// Initializes a new instance of the <see cref="GooglePlayGames.BasicApi.PlayGamesClientConfiguration"/> struct.
/// </summary>
/// <param name="builder">Builder for this configuration.</param>
private PlayGamesClientConfiguration(Builder builder)
{
this.mEnableSavedGames = builder.HasEnableSaveGames();
this.mInvitationDelegate = builder.GetInvitationDelegate();
this.mMatchDelegate = builder.GetMatchDelegate();
this.mPermissionRationale = builder.GetPermissionRationale();
}
开发者ID:Ratel13,项目名称:play-games-plugin-for-unity,代码行数:11,代码来源:PlayGamesClientConfiguration.cs
示例4: m3
public static void m3()
{
SqlConnectionStringBuilder sqlConnectionStringBuilder = new SqlConnectionStringBuilder();
sqlConnectionStringBuilder.DataSource = @"RoXaSDTD-PC\SQLEXPRESS";
sqlConnectionStringBuilder.InitialCatalog = "PlaylistManager";
sqlConnectionStringBuilder.UserID = "Rafael";
sqlConnectionStringBuilder.Password = "rafael";
sqlConnectionStringBuilder.IntegratedSecurity = true;
string connectionString = sqlConnectionStringBuilder.ConnectionString;
Builder builder = new Builder(
typeof(SqlDataMapper<>),
new Object[] { connectionString },
typeof(PropertyColumnMapper),
typeof(MultipleConnectionPolicy));
IDataMapper<Playlist> playlistMapper = builder.Build<Playlist>();
IConnectionPolicy policy = playlistMapper.GetConnectionPolicy();
Playlist p = playlistMapper.GetAll().First();
p.name = "teste";
playlistMapper.Update(p);
Playlist p2 = playlistMapper.GetAll().First();
p2.name = "JoanaPlaylist";
playlistMapper.Update(p2);
}
开发者ID:RafaelSPaulo,项目名称:SQL_Mapper,代码行数:27,代码来源:SqlMapperManualTest.cs
示例5: ProcessRequest
public void ProcessRequest(IDictionary<string, object> environment,
ResponseCallBack responseCallBack, Action<Exception> errorCallback)
{
Dictionary<string, dynamic> nrackEnvironment = GetNrackEnvironment(environment);
var config = ConfigResolver.GetRackConfigInstance();
var builder = new Builder(config.ExecuteStart);
var response = new OwinResponseAdapter(builder.Call(nrackEnvironment));
responseCallBack(response.Status, response.Headers.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToString()),
(next, error, complete) =>
{
try
{
next(response.GetBody(), null);
complete();
}
catch (Exception ex)
{
error(ex);
}
return () => { };
});
}
开发者ID:kevinswiber,项目名称:NRack,代码行数:25,代码来源:OwinHandler.cs
示例6: ConnectionRejectingTimeoutTest
public void ConnectionRejectingTimeoutTest()
{
var originalTraceLevel = Diagnostics.CassandraTraceSwitch.Level;
Diagnostics.CassandraTraceSwitch.Level = TraceLevel.Verbose;
var sw = Stopwatch.StartNew();
var thrown = false;
try
{
var builder = new Builder().WithDefaultKeyspace("system")
.AddContactPoints("127.9.9.9") // local IP that will most likely not be in use
.WithQueryTimeout(500);
builder.SocketOptions.SetConnectTimeoutMillis(500);
var cluster = builder.Build();
cluster.Connect();
}
catch (NoHostAvailableException)
{
thrown = true;
}
sw.Stop();
Assert.True(thrown, "Expected exception");
Assert.True(sw.Elapsed.TotalMilliseconds < 1000, "The connection timeout was not respected");
Diagnostics.CassandraTraceSwitch.Level = originalTraceLevel;
}
开发者ID:Virus-X,项目名称:csharp-driver,代码行数:27,代码来源:ConnectionTimeoutTest.cs
示例7: WebSiteEnvironmnents
Dictionary<string, IEnumerable<WebSiteConfig>> WebSiteEnvironmnents()
{
var webSite = new Builder<WebSiteConfig>(() => new WebSiteConfig {
AppPoolName = "MyWebSite",
Port = 80,
HostName = "mywebsite.com",
Directory = @"C:\Sites\MyWebSite",
});
var envs = new Dictionary<string,IEnumerable<WebSiteConfig>>();
var live = webSite;
envs["live"] = live.OnMachines("live1", "live2");
var stage = webSite.WithHostName("mywebsitestage.com");
envs["stage"] = stage.OnMachines("stage1", "stage2");
var test = webSite.WithHostName("mywebsitetest");
envs["test"] = test.OnMachines("test1");
var dev = webSite.WithNoHostName().WithPort(6001);
envs["dev"] = dev.OnMachines("localhost");
return envs;
}
开发者ID:nbucket,项目名称:bounce,代码行数:25,代码来源:BuilderTest.cs
示例8: When_class_is_changed_to_interface_changed_attributes_are_reported
public void When_class_is_changed_to_interface_changed_attributes_are_reported()
{
Assembly assembly1 = ApiBuilder.CreateApi().Class("Class").Build().Build();
Assembly assembly2 = ApiBuilder.CreateApi().Interface("Class").Build().Build();
var sut = new Builder(assembly1, assembly2).ComparerResultMock;
sut.Verify(result => result.AddChangedFlag("Interface", false, Severity.Error), Times.Once);
}
开发者ID:gitter-badger,项目名称:ApiCheck,代码行数:7,代码来源:TypeComparerTest.cs
示例9: ToByteArray
public override byte[] ToByteArray()
{
Builder<byte> b = new Builder<byte>();
b.Append(PacketID);
b.Append(PlayerID);
return b.ToArray();
}
开发者ID:welterde,项目名称:Spacecraft,代码行数:7,代码来源:ServerPackets.cs
示例10: GetSecurityService
protected override ISecurityService GetSecurityService()
{
var userBuilder = new Builder<IUser>(Mock.Of<IUser>)
.With(u =>
{
u.Email = SecurityTestData.User.Email;
u.PasswordHash = HashService.Hash64(SecurityTestData.User.CorrectPassword);
u.Active = true;
});
var user = userBuilder.Build();
var inactiveUser = userBuilder
.Build(u =>
{
u.Email = SecurityTestData.User.InactiveEmail;
u.Active = false;
});
return new SecurityService(
new UserDataServiceBuilder()
.WithUser(user)
.WithUser(inactiveUser)
.Build(),
new SessionDataServiceBuilder()
.Build(),
HashService,
new UserRegistrationValidator()
);
}
开发者ID:MrAntix,项目名称:Poci,代码行数:29,代码来源:user_tests_with_mock_data_layer.cs
示例11: UpdateSupplierFromProduct
public void UpdateSupplierFromProduct()
{
// Arrange
Builder builder = new Builder(
SqlDataMapperType,
DataMapperParams,
PropertyColumnMapperType,
MultipleConnectionPolicyType);
IDataMapper productMapper = builder.Build<Product>();
IConnectionPolicy explicitConnectionPolicy = productMapper.GetConnectionPolicy();
String fakeName = "teste";
String trueName = "";
String updatedName = "";
// Act
Product p1 = (Product)productMapper.GetAll().First();
trueName = p1.SupplierID.CompanyName;
p1.SupplierID.CompanyName = fakeName;
productMapper.Update(p1);
Product p2 = (Product)productMapper.GetAll().First();
updatedName = p2.SupplierID.CompanyName;
p2.SupplierID.CompanyName = trueName;
productMapper.Update(p2);
// Assert
Assert.AreEqual(fakeName, updatedName);
}
开发者ID:RafaelSPaulo,项目名称:SQL_Mapper,代码行数:28,代码来源:SqlMapperUnitTest.cs
示例12: ServerLimits
private ServerLimits(Builder builder)
{
if (builder.mailbox_max_count_per_user < 0)
throw new ArgumentException("Invalid domain id", "builder");
MailboxMaxCountPerUser = builder.mailbox_max_count_per_user;
}
开发者ID:vipwan,项目名称:CommunityServer,代码行数:7,代码来源:ServerLimits.cs
示例13: CanCreateInstances
public void CanCreateInstances()
{
string config =
@"<object-builder-config xmlns=""pag-object-builder"">
<build-rules>
<build-rule type=""" + FullNameSimpleObject + @""" mode=""Instance"">
<constructor-params>
<value-param type=""System.Int32"">12</value-param>
</constructor-params>
</build-rule>
</build-rules>
</object-builder-config>";
Builder builder = new Builder(ObjectBuilderXmlConfig.FromXml(config));
Locator locator = CreateLocator();
SimpleObject m1 = builder.BuildUp<SimpleObject>(locator, null, null);
SimpleObject m2 = builder.BuildUp<SimpleObject>(locator, null, null);
Assert.IsNotNull(m1);
Assert.IsNotNull(m2);
Assert.AreEqual(12, m1.IntParam);
Assert.AreEqual(12, m2.IntParam);
Assert.IsTrue(m1 != m2);
}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:25,代码来源:BuilderConfigTests.cs
示例14: CreatingAList
public void CreatingAList()
{
var builderSetup = new BuilderSetup();
var products = new Builder<Product>(builderSetup).CreateListOfSize(10).Build();
// Note: The asserts here are intentionally verbose to show how NBuilder works
// It sets strings to their name plus their 1-based sequence number
Assert.That(products[0].Title, Is.EqualTo("Title1"));
Assert.That(products[1].Title, Is.EqualTo("Title2"));
Assert.That(products[2].Title, Is.EqualTo("Title3"));
Assert.That(products[3].Title, Is.EqualTo("Title4"));
Assert.That(products[4].Title, Is.EqualTo("Title5"));
Assert.That(products[5].Title, Is.EqualTo("Title6"));
Assert.That(products[6].Title, Is.EqualTo("Title7"));
Assert.That(products[7].Title, Is.EqualTo("Title8"));
Assert.That(products[8].Title, Is.EqualTo("Title9"));
Assert.That(products[9].Title, Is.EqualTo("Title10"));
// Ints are set to their 1-based sequence number
Assert.That(products[0].Id, Is.EqualTo(1));
// ... 2, 3, 4, 5, 6, 7, 8 ...
Assert.That(products[9].Id, Is.EqualTo(10));
// Any other numeric types are set to their 1-based sequence number
Assert.That(products[0].PriceBeforeTax, Is.EqualTo(1m));
// ... 2m, 3m, 4m, 5m, 6m, 7m, 8m ...
Assert.That(products[9].PriceBeforeTax, Is.EqualTo(10m));
}
开发者ID:QuarterSpot,项目名称:nbuilder,代码行数:29,代码来源:ListBuilderTests.cs
示例15: CreateBuilder
public Builder CreateBuilder()
{
Builder temp = new Builder(new Vector2(50, 50), 3);
this.builders.Add(temp);
this.idleBuilders.Add(temp);
return temp;
}
开发者ID:jlvermeulen,项目名称:bunka,代码行数:7,代码来源:ConstructionManager.cs
示例16: CreateBuilder
public static Builder CreateBuilder()
{
var logger = GlobalLogger.GetLogger("Builder");
logger.ActivateLog(LogMessageType.Debug);
var builder = new Builder(BuildPath, "Windows", "index", "inputHashes", logger) { BuilderName = "TestBuilder", SlaveBuilderPath = @"SiliconStudio.BuildEngine.exe" };
return builder;
}
开发者ID:Powerino73,项目名称:paradox,代码行数:7,代码来源:Utils.cs
示例17: PersistingAListOfProductsAndCategories
public void PersistingAListOfProductsAndCategories()
{
const int numProducts = 500;
const int numCategories = 50;
const int numCategoriesForEachProduct = 5;
var builder = new Builder(builderSettings);
var categories = builder
.CreateListOfSize<Category>(numCategories)
.Persist();
builder
.CreateListOfSize<Product>(numProducts)
.All()
.With(x => x.Categories = Pick<Category>.
UniqueRandomList(With.Exactly(numCategoriesForEachProduct).Elements)
.From(categories)
.ToList())
.Persist(); // NB: Persistence is setup in the RepositoryBuilderSetup class
DataTable productsTable = Database.GetContentsOf(Database.Tables.Product);
DataTable categoriesTable = Database.GetContentsOf(Database.Tables.Category);
DataTable productCategoriesTable = Database.GetContentsOf(Database.Tables.ProductCategory);
Assert.That(productsTable.Rows.Count, Is.EqualTo(numProducts), "products");
Assert.That(categoriesTable.Rows.Count, Is.EqualTo(numCategories), "categories");
Assert.That(productCategoriesTable.Rows.Count, Is.EqualTo(numCategoriesForEachProduct * numProducts));
}
开发者ID:nbuilder,项目名称:nbuilder,代码行数:28,代码来源:EntityFrameworkPersistenceTests.cs
示例18: GuitarSpec
public GuitarSpec(Builder builder, string model, Typeg type,
int numStrings, Wood backWood, Wood topWood)
: base(builder,model,type,
backWood,topWood)
{
this.numStrings = numStrings;
}
开发者ID:juanferfranco,项目名称:PDOO,代码行数:7,代码来源:GuitarSpec.cs
示例19: m1
public static void m1()
{
Builder builder = new Builder(
SqlDataMapperType,
DataMapperParams,
PropertyColumnMapperType,
MultipleConnectionPolicyType);
IDataMapper<ProductSimple> productMapper = builder.Build<ProductSimple>();
ISqlEnumerable<ProductSimple> prods = productMapper.GetAll();
foreach (ProductSimple p in prods)
{
Console.WriteLine(p);
}
Console.WriteLine("-------------");
ISqlEnumerable<ProductSimple> prods2 = prods.Where("CategoryID = 7");
foreach (ProductSimple p in prods2)
{
Console.WriteLine(p);
}
Console.WriteLine("-------------");
ISqlEnumerable<ProductSimple> prods3 = prods2.Where("UnitsinStock > 30");
foreach (ProductSimple p in prods3)
{
Console.WriteLine(p);
}
}
开发者ID:RafaelSPaulo,项目名称:SQL_Mapper,代码行数:29,代码来源:SqlMapperManualTest.cs
示例20: m2
public static void m2()
{
Builder builder = new Builder(
typeof(SqlDataMapper<>),
new Object[] { SqlMapperUnitTest.getMySqlConnectionString() },
typeof(PropertyColumnMapper),
typeof(ExplicitConnectionPolicy));
IDataMapper<ProductSimple> productMapper = builder.Build<ProductSimple>();
IConnectionPolicy explicitConnectionPolicy = productMapper.GetConnectionPolicy();
// Act
explicitConnectionPolicy.OpenConnection();
explicitConnectionPolicy.BeginTransaction();
ProductSimple p1 = productMapper.GetAll().First();
p1.ProductName = "Potatoes";
productMapper.Update(p1);
ProductSimple p2 = productMapper.GetAll().First();
// Assert
bool result = p1.ProductName == p2.ProductName;
explicitConnectionPolicy.RollBack();
explicitConnectionPolicy.Dispose();
}
开发者ID:RafaelSPaulo,项目名称:SQL_Mapper,代码行数:27,代码来源:SqlMapperManualTest.cs
注:本文中的Builder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论