当前位置: 首页>>代码示例>>C#>>正文


C# Seed类代码示例

本文整理汇总了C#中Seed的典型用法代码示例。如果您正苦于以下问题:C# Seed类的具体用法?C# Seed怎么用?C# Seed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Seed类属于命名空间,在下文中一共展示了Seed类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: specify_db_can_be_specified

        void specify_db_can_be_specified()
        {
            var connectionString = ConfigurationManager.ConnectionStrings["AnotherDb"].ConnectionString;

            seed = new Seed(new ConnectionProfile
            {
                ConnectionString = connectionString
            });

            seed.PurgeDb();

            seed.CreateTable("Authors",
                seed.Id(),
                new { Name = "nvarchar(255)" }
            ).ExecuteNonQuery(seed.ConnectionProfile);

            seed.CreateTable("Emails",
                seed.Id(),
                new { AuthorId = "int" },
                new { Address = "nvarchar(255)" }
            ).ExecuteNonQuery(seed.ConnectionProfile);

            db = new DynamicDb(connectionString);

            var authorId = db.Authors().Insert(new { Name = "hello" });

            db.Emails().Insert(new { authorId, Address = "[email protected]" });

            (db.Authors().All().First().Email().Address as string).should_be("[email protected]");
        }
开发者ID:eugman,项目名称:Oak,代码行数:30,代码来源:core_behavior_dynamic_db.cs

示例2: before_each

        void before_each()
        {
            seed = new Seed();

            GameSchema.CreateSchema(seed);

            players = new Players();

            player1Id = new { Name = "Jane" }.InsertInto("Players");

            player2Id = new { Name = "John" }.InsertInto("Players");

            game1Id = new { Title = "Mirror's Edge" }.InsertInto("Games");

            game2Id = new { Title = "Gears of War" }.InsertInto("Games");

            new { PlayerId = player1Id, GameId = game2Id }.InsertInto("Library");

            new { PlayerId = player2Id, GameId = game1Id }.InsertInto("Library");

            new { PlayerId = player2Id, GameId = game2Id }.InsertInto("Library");

            sqlQueries = new List<string>();

            DynamicRepository.WriteDevLog = true;

            DynamicRepository.LogSql = new Action<object, string, object[]>(
                (sender, sql, @params) =>
                {
                    sqlQueries.Add(sql);
                });
        }
开发者ID:pragmaticlogic,项目名称:Oak,代码行数:32,代码来源:eager_loading_for_belongs_to_with_duplicates.cs

示例3: create_seed

	protected Seed	create_seed(string id)
	{
		string	local_account = AccountManager.get().getAccountData(GlobalParam.get().global_account_id).account_id;

		Seed	seed = null;

		seed = this.seeds.Find(x => x.id == id);

		if(seed == null) {

			// 찾지 못했으므로 만든다.
			seed = new Seed(local_account, id);

			this.seeds.Add(seed);

			// [TODO] seeds가 전 단말에서 공통되게 동기화한다.

		} else {

			if(seed.creator == local_account) {
	
				// 같은 id의 시드를 두 번이상 만들려고 함.
				Debug.LogError("Seed \"" + id + "\" already exist.");
				seed = null;

			} else {

				// 다른 플레이어가 만든 같은 시드가 있었다.
			}
		}

		return(seed);
	}
开发者ID:fotoco,项目名称:006772,代码行数:33,代码来源:PseudoRandom.cs

示例4: SetState

 public void SetState(Seed seed, SearchState state)
 {
     lock (_thisLock)
     {
         _seedsDictionary.AddOrUpdate(seed, state, (_, orignalState) => orignalState | state);
     }
 }
开发者ID:Alliance-Network,项目名称:Amoeba,代码行数:7,代码来源:SeedStateCache.cs

示例5: before_each

        void before_each()
        {
            seed = new Seed();

            seed.PurgeDb();

            cars = new Cars();

            seed.CreateTable("Cars",
                new { Id = "int" },
                new { Model = "nvarchar(255)" }).ExecuteNonQuery();

            seed.CreateTable("BluePrints",
                new { Id = "int" },
                new { CarId = "int" },
                new { Sku = "nvarchar(255)" }).ExecuteNonQuery();

            car1Id = 100;
            new { Id = car1Id, Model = "car 1" }.InsertInto("Cars");

            car2Id = 200;
            new { Id = car2Id, Model = "car 2" }.InsertInto("Cars");

            bluePrint1Id = 300;
                
            new { Id = bluePrint1Id, CarId = car1Id, Sku = "Sku 1" }.InsertInto("BluePrints");

            bluePrint2Id = 400;

            new { Id = bluePrint2Id, CarId = car2Id, Sku = "Sku 2" }.InsertInto("BluePrints");
        }
开发者ID:eugman,项目名称:Oak,代码行数:31,代码来源:eager_loading_for_has_one.cs

示例6: GenerateNodeKeyTest

 public void GenerateNodeKeyTest()
 {
     var zeroBytes = new byte[16];
     var pair = new Seed(zeroBytes).SetNodeKey().KeyPair();
     Assert.AreEqual("n9LPxYzbDpWBZ1bC3J3Fdkgqoa3FEhVKCnS8yKp7RFQFwuvd8Q2c", 
                     pair.Id());
 }
开发者ID:sublimator,项目名称:ripple-dot-net,代码行数:7,代码来源:DerivationTests.cs

示例7: before_each

        void before_each()
        {
            seed = new Seed();

            markets = new Markets();

            seed.PurgeDb();

            seed.CreateTable("Markets",
                seed.Id(),
                new { Name = "nvarchar(255)" }).ExecuteNonQuery();

            seed.CreateTable("SupplyChains",
                seed.Id(),
                new { MarketId = "int" },
                new { SupplierId = "int" }).ExecuteNonQuery();

            seed.CreateTable("Suppliers",
                seed.Id(),
                new { Name = "nvarchar(255)" }).ExecuteNonQuery();

            supplier1Id = new { Name = "Supplier 1" }.InsertInto("Suppliers");

            supplier2Id = new { Name = "Supplier 2" }.InsertInto("Suppliers");

            market1Id = new { Name = "Market 1" }.InsertInto("Markets");

            market2Id = new { Name = "Market 2" }.InsertInto("Markets");

            new { MarketId = market1Id, SupplierId = supplier1Id }.InsertInto("SupplyChains");

            new { MarketId = market2Id, SupplierId = supplier1Id }.InsertInto("SupplyChains");
        }
开发者ID:bforrest,项目名称:Oak,代码行数:33,代码来源:eager_loading_for_has_many_through.cs

示例8: onLeftMouseDown

 //For testing purposes we print out plant species
 public string onLeftMouseDown(Seed playerSeed, Plant playerPlant)
 {
     if(occupied)
     {
         return "Space is occupied!";
         // Call remove function?
     }
     //If player is holding seed, set it.
     else if(playerSeed)
     {
         currentSeed = playerSeed;
         occupied = true;
         currentSeed.GetComponent<Seed>().currentSpace = this.gameObject.GetComponent<Plantable_Space>();
         //Spawn GameObject of Seed
         return "Planted " + playerSeed.species;
     }
     //Else if holding a plant, set that.
     else if(playerPlant)
     {
         currentPlant = playerPlant;
         occupied = true;
         currentPlant.GetComponent<Plant>().currentSpace = this.gameObject.GetComponent<Plantable_Space>();
         return "Planted " + playerPlant.species;
     }
     else
     {
         //Player has no plant or seed selected in inventory, nothing happens.
         return null;
     }
 }
开发者ID:JaromNorris,项目名称:Retake-Game,代码行数:31,代码来源:Plantable_Space.cs

示例9: Crop

 /// <summary>
 /// Initializes a new crop
 /// </summary>
 public Crop(string name, double weight, Seed parentSeed)
 {
     Name = name;
       EndWeight = weight;
       CalculateQuality();
       ParentSeed = parentSeed;
 }
开发者ID:coczero,项目名称:ConsoleFarmingSimulator,代码行数:10,代码来源:Crop.cs

示例10: before_each

        void before_each()
        {
            seed = new Seed();

            books = new Books();

            seed.PurgeDb();

            seed.CreateTable("Books",
                seed.Id(),
                new { Title = "nvarchar(255)" }).ExecuteNonQuery();

            seed.CreateTable("Chapters",
                seed.Id(),
                new { BookId = "int" },
                new { Name = "nvarchar(255)" }).ExecuteNonQuery();

            book1Id = new { Title = "book 1" }.InsertInto("Books");

            new { BookId = book1Id, Name = "Chapter 1" }.InsertInto("Chapters");

            new { BookId = book1Id, Name = "Chapter 2" }.InsertInto("Chapters");

            book2Id = new { Title = "book 2" }.InsertInto("Books");

            new { BookId = book2Id, Name = "Chapter 1" }.InsertInto("Chapters");

            new { BookId = book2Id, Name = "Chapter 2" }.InsertInto("Chapters");
        }
开发者ID:bforrest,项目名称:Oak,代码行数:29,代码来源:eager_loading_for_has_many.cs

示例11: Test_AmoebaConverter_Box

        public void Test_AmoebaConverter_Box()
        {
            var key = new Key(HashAlgorithm.Sha256, new byte[32]);
            var metadata = new Metadata(1, key, CompressionAlgorithm.Xz, CryptoAlgorithm.Aes256, new byte[32 + 32]);
            var seed = new Seed(metadata);
            seed.Name = "aaaa.zip";
            seed.Keywords.AddRange(new KeywordCollection
                {
                    "bbbb",
                    "cccc",
                    "dddd",
                });
            seed.CreationTime = DateTime.Now;
            seed.Length = 10000;

            var box = new Box();
            box.Name = "Box";
            box.Seeds.Add(seed);
            box.Boxes.Add(new Box() { Name = "Box" });

            Box box2;

            using (var streamBox = AmoebaConverter.ToBoxStream(box))
            {
                box2 = AmoebaConverter.FromBoxStream(streamBox);
            }

            Assert.AreEqual(box, box2, "AmoebaConverter #3");
        }
开发者ID:Alliance-Network,项目名称:Library,代码行数:29,代码来源:Test_Library_Net_Amoeba.cs

示例12: Test_AmoebaConverter_Seed

        public void Test_AmoebaConverter_Seed()
        {
            var seed = new Seed();
            seed.Name = "aaaa.zip";
            seed.Keywords.AddRange(new KeywordCollection
            {
                "bbbb",
                "cccc",
                "dddd",
            });
            seed.CreationTime = DateTime.Now;
            seed.Length = 10000;
            seed.Comment = "eeee";
            seed.Rank = 1;
            seed.Key = new Key(new byte[32], HashAlgorithm.Sha256);
            seed.CompressionAlgorithm = CompressionAlgorithm.Xz;
            seed.CryptoAlgorithm = CryptoAlgorithm.Aes256;
            seed.CryptoKey = new byte[32 + 32];

            DigitalSignature digitalSignature = new DigitalSignature("123", DigitalSignatureAlgorithm.Rsa2048_Sha256);
            seed.CreateCertificate(digitalSignature);

            var stringSeed = AmoebaConverter.ToSeedString(seed);
            var seed2 = AmoebaConverter.FromSeedString(stringSeed);

            Assert.AreEqual(seed, seed2, "AmoebaConverter #2");
        }
开发者ID:networkelements,项目名称:Library,代码行数:27,代码来源:Test_Library_Net_Amoeba.cs

示例13: FertileDirtGump

        public FertileDirtGump(Seed seed, int amount, object attachTo)
            : base(50, 50)
        {
            m_Seed = seed;
            m_AttachTo = attachTo;

            AddBackground(0, 0, 300, 210, 9200);
            AddImageTiled(5, 5, 290, 30, 2624);
            AddImageTiled(5, 40, 290, 100, 2624);
            AddImageTiled(5, 145, 150, 60, 2624);
            AddImageTiled(160, 145, 135, 60, 2624);

            AddHtmlLocalized(90, 10, 150, 16, 1150359, LabelColor, false, false); // Raised Garden Bed
            AddHtmlLocalized(10, 45, 280, 90, 1150363, LabelColor, false, false);

            AddHtmlLocalized(10, 150, 80, 16, 1150361, LabelColor, false, false); // Needed:
            AddHtmlLocalized(10, 180, 80, 16, 1150360, LabelColor, false, false); // You Have:

            AddHtml(80, 150, 60, 16, String.Format("<BASEFONT COLOR=#{0:X6}>20</BASEFONT>", FontColor), false, false);
            AddHtml(80, 180, 60, 16, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, amount.ToString()), false, false);

            AddButton(165, 150, 4023, 4025, 1, GumpButtonType.Reply, 0);
            AddButton(165, 180, 4017, 4019, 2, GumpButtonType.Reply, 0);

            AddHtml(205, 150, 100, 16, String.Format("<BASEFONT COLOR=#{0:X6}>Use</BASEFONT>", FontColor), false, false);
            AddHtmlLocalized(205, 180, 100, 16, 1150364, LabelColor, false, false); // Not Use
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:27,代码来源:FertileDirtGump.cs

示例14: SeedManagementViewModel

 public SeedManagementViewModel(SeedModel.IDataAccessService servPxy)
 {
     dataAccessService = servPxy;
     AddSeedCommand = new RelayCommand(SaveSeed);
     DeleteSeedCommand = new RelayCommand<Seed>(DeleteSeed);
     NewSeed = new Seed();
     SeedList = dataAccessService.GetSeeds();
 }
开发者ID:8ezhikov,项目名称:Git4Life,代码行数:8,代码来源:SeedManagementViewModel.cs

示例15: before_each

        void before_each()
        {
            seed = new Seed();

            records = new MemoizedRecords();

            seed.PurgeDb();
        }
开发者ID:girish66,项目名称:Oak,代码行数:8,代码来源:memoization_application.cs


注:本文中的Seed类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。