private void initialize(SharpSerializerXmlSettings settings) { // PropertiesToIgnore PropertyProvider.PropertiesToIgnore = settings.AdvancedSettings.PropertiesToIgnore; PropertyProvider.AttributesToIgnore = settings.AdvancedSettings.AttributesToIgnore; //RootName RootName = settings.AdvancedSettings.RootName; // TypeNameConverter) ITypeNameConverter typeNameConverter = settings.AdvancedSettings.TypeNameConverter ?? DefaultInitializer.GetTypeNameConverter( settings.IncludeAssemblyVersionInTypeName, settings.IncludeCultureInTypeName, settings.IncludePublicKeyTokenInTypeName); // SimpleValueConverter ISimpleValueConverter simpleValueConverter = settings.AdvancedSettings.SimpleValueConverter ?? DefaultInitializer.GetSimpleValueConverter(settings.Culture, typeNameConverter); // XmlWriterSettings XmlWriterSettings xmlWriterSettings = DefaultInitializer.GetXmlWriterSettings(settings.Encoding); // XmlReaderSettings XmlReaderSettings xmlReaderSettings = DefaultInitializer.GetXmlReaderSettings(); // Create Serializer and Deserializer var reader = new DefaultXmlReader(typeNameConverter, simpleValueConverter, xmlReaderSettings); var writer = new DefaultXmlWriter(typeNameConverter, simpleValueConverter, xmlWriterSettings); _serializer = new XmlPropertySerializer(writer); _deserializer = new XmlPropertyDeserializer(reader); }
private void initialize(SharpSerializerBinarySettings settings) { // PropertiesToIgnore this.PropertyProvider.PropertiesToIgnore = settings.AdvancedSettings.PropertiesToIgnore; this.PropertyProvider.AttributesToIgnore = settings.AdvancedSettings.AttributesToIgnore; //RootName this.RootName = settings.AdvancedSettings.RootName; // TypeNameConverter) ITypeNameConverter typeNameConverter = settings.AdvancedSettings.TypeNameConverter ?? DefaultInitializer.GetTypeNameConverter( settings.IncludeAssemblyVersionInTypeName, settings.IncludeCultureInTypeName, settings.IncludePublicKeyTokenInTypeName); // Create Serializer and Deserializer Polenter.Serialization.Advanced.Binary.IBinaryReader reader = null; Polenter.Serialization.Advanced.Binary.IBinaryWriter writer = null; if (settings.Mode == BinarySerializationMode.Burst) { // Burst mode writer = new BurstBinaryWriter(typeNameConverter, settings.Encoding); reader = new BurstBinaryReader(typeNameConverter, settings.Encoding); } else { // Size optimized mode writer = new SizeOptimizedBinaryWriter(typeNameConverter, settings.Encoding); reader = new SizeOptimizedBinaryReader(typeNameConverter, settings.Encoding); } this._deserializer = new BinaryPropertyDeserializer(reader); this._serializer = new BinaryPropertySerializer(writer); }
internal static void Main(string[] args) { var app = DefaultInitializer.Initialize(); //var app = SimpleInjectorInitializer.Initialize(); app.Run(args); }
private void Initialize(BinarySettings settings) { //RootName RootName = settings.AdvancedSettings.RootName; // TypeNameConverter) var typeNameConverter = settings.AdvancedSettings.TypeNameConverter ?? DefaultInitializer.GetTypeNameConverter( settings.IncludeAssemblyVersionInTypeName, settings.IncludeCultureInTypeName, settings.IncludePublicKeyTokenInTypeName); // Create Serializer and Deserializer IBinaryReader reader = null; IBinaryWriter writer = null; if (settings.Mode == BinarySerializationMode.Burst) { // Burst mode writer = new BurstBinaryWriter(typeNameConverter, settings.Encoding); reader = new BurstBinaryReader(typeNameConverter, settings.Encoding); } else { // Size optimized mode writer = new SizeOptimizedBinaryWriter(typeNameConverter, settings.Encoding); reader = new SizeOptimizedBinaryReader(typeNameConverter, settings.Encoding); } _deserializer = new BinaryPropertyDeserializer(reader); _serializer = new BinaryPropertySerializer(writer); }
static Program() { IocLocator.Container(new AdvancedContainerFactory()); _container.Register <TfsProperties>(); _container.Register <IProcessLogger, ConsoleLogger>(); _initializer = new DefaultInitializer(); CreateServiceList(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserManager <User> userManager) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); DefaultInitializer.SeedUsers(userManager); if (!env.IsDevelopment()) { app.UseSpaStaticFiles(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Tutor 101 API V1"); c.RoutePrefix = "swagger"; }); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); }
public static async Task Main(string[] args) { var host = CreateHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var userManager = services.GetRequiredService <UserManager <User> >(); var rolesManager = services.GetRequiredService <RoleManager <IdentityRole> >(); await DefaultInitializer.InitializeAsync(userManager, rolesManager); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "An error occurred while seeding the database."); } } host.Run(); }
private void SetUpDefaltDb(MyDbContext context) { DefaultInitializer.Setup(context); }