示例#1
0
 public Material(RigidBody rigidBody, PX.Material wrappedMaterial, MaterialDescriptor descriptor)
 {
     wrappedMaterial.DynamicFriction = descriptor.Friction;
     wrappedMaterial.StaticFriction  = descriptor.Friction;
     wrappedMaterial.Restitution     = descriptor.Restitution;
     _wrappedMaterial = wrappedMaterial;
     Configurator     = new BaseConfigurator <IMaterial>();
 }
示例#2
0
 public Material(RigidBody rigidBody, PX.Material wrappedMaterial, MaterialDescriptor descriptor)
 {
     wrappedMaterial.DynamicFriction = descriptor.Friction;
     wrappedMaterial.StaticFriction = descriptor.Friction;
     wrappedMaterial.Restitution = descriptor.Restitution;
     _wrappedMaterial = wrappedMaterial;
     Configurator = new BaseConfigurator<IMaterial>();
 }
        //public static void ConfigureBaseProperties<T, U>( EntityTypeBuilder<T> builder) where U : class where T : IReferenceBase<U>
        public static void ConfigureBaseProperties <T>(ref EntityTypeBuilder <T> builder) where T : class, IReferenceBase <T>
        {
            BaseConfigurator.ConfigureBaseProperties <T>(ref builder);

            builder.HasKey(s => s.Id);

            ////// Why?????
            //////Microsoft.Data.SqlClient.SqlException(0x80131904): Не удалось создать внешний ключ "FK_Contragents_Contragents_ParentID" со ссылочным действием SET NULL, поскольку один или несколько ссылающихся столбцов не допускают значения NULL.
            builder.HasOne(s => s.Parent).WithMany(p => p.Children).HasForeignKey(s => s.ParentID).OnDelete(DeleteBehavior.NoAction);

            builder.HasIndex(s => s.Code);
            builder.HasIndex(s => s.IsDeleted);
            builder.HasIndex(s => s.IsFolder);
            builder.HasIndex(s => s.IsPredefined);
            builder.HasIndex(s => s.Name);
            builder.HasIndex(s => s.ParentID);

            builder.Property(s => s.Code).IsRequired();
            builder.Property(s => s.IsDeleted).IsRequired().HasDefaultValue(false);
            builder.Property(s => s.IsFolder).IsRequired();
            builder.Property(s => s.IsPredefined).IsRequired().HasDefaultValue(false);
            builder.Property(s => s.Name).IsRequired();
        }
示例#4
0
        private void PrintHelloWorld()
        {
            var collectionName = BaseConfigurator.GetAppCollectionName();
            var context        = new DbContext(collectionName);
            var broker         = new EventBroker <DbContext>(context);

            int length     = BaseConfigurator.GetTargetStringLength();
            var asciiChars = new List <AsciiChar>();

            for (int i = 0; i < length; i++)
            {
                char character = BaseConfigurator.GetTargetString()[i];
                var  dbQuery   = Query.EQ("Character", character.ToString());

                var query  = new GetCharacterQuery(new AsciiChar(), dbQuery);
                var target = broker.Query <GetCharacterQuery, AsciiChar>(query);
                asciiChars.Add(target);
            }

            foreach (var item in asciiChars)
            {
                Console.Write(item.Character);
            }
        }
示例#5
0
 public DbContext(string collection)
 {
     this.collection = collection;
     this.dbPath     = BaseConfigurator.GetDatabasePath();
 }