public void Apply(IOneToManyCollectionInstance instance) { instance.Key.Column(string.Format(CultureInfo.InvariantCulture, "{0}_id", NameConverter.ConvertName(instance.EntityType.Name))); instance.Key.ForeignKey(string.Format(CultureInfo.InvariantCulture, "fk_{0}_{1}", NameConverter.ConvertName(instance.Member.Name), NameConverter.ConvertName(instance.EntityType.Name))); }
public void Apply(IIdentityInstance instance) { var sequenceName = string.Format(CultureInfo.InvariantCulture, "{0}_id_seq", NameConverter.ConvertName(instance.EntityType.Name)); var columnName = string.Format(CultureInfo.InvariantCulture, "{0}", NameConverter.ConvertName(instance.Property.Name)); instance.GeneratedBy.Native(sequenceName); instance.Column(columnName); }
public void Apply(IManyToOneInstance instance) { var entityName = NameConverter.ConvertName(instance.EntityType.Name); var columnName = NameConverter.ConvertName(instance.Name); var keyName = string.Format("fk_{0}_{1}", columnName, entityName); instance.ForeignKey(keyName); instance.Column(string.Format(CultureInfo.InvariantCulture, "{0}_id", columnName)); instance.Index(string.Format(CultureInfo.InvariantCulture, "ix_{0}_{1}_id", entityName, columnName)); }
public async Task PlayerChart(string name) { using (var c = new BarcabotDatabaseConnection()) { var playerObject = c.GetPlayerByName(name); if (playerObject == null) { await Context.Channel.SendMessageAsync( $":warning: Error: Could not find player `{name}`. Are you sure they exist and are a FCB player?\nIf you think there is a player missing from the database please report it to the creator of BarcaBot `Trace#8994`."); } else { var convertedName = NameConverter.ConvertName(playerObject.Name); var stats = playerObject.Per90Stats; var x = new ArrayList { "Shots", "Shots on Target", "Key Passes", "Tackles", "Blocks", "Interceptions", "Duels Won", "Dribbles Attempted", "Dribbles Won", "Fouls Drawn", "Fouls Committed" }; var y = new ArrayList { stats.Shots.Total, stats.Shots.OnTarget, stats.Passes.KeyPasses, stats.Tackles.TotalTackles, stats.Tackles.Blocks, stats.Tackles.Interceptions, stats.Duels.Won, stats.Dribbles.Attempted, stats.Dribbles.Won, stats.Fouls.Drawn, stats.Fouls.Committed }; var chart = new PlotlyChart { Figure = new Figure { Data = new ArrayList { new BarTrace { X = x, Y = y, Name = convertedName } }, Layout = GetLayout($"{convertedName} Per 90 Stats", false) }, Height = 500, Width = 1000 }; var chartAsBytes = await _plotlyClient.GetChartAsByteArray(chart); var stream = new MemoryStream(chartAsBytes); await Context.Channel.SendFileAsync(stream, "chart.png"); } } }
public void Apply(IManyToManyCollectionInstance instance) { var memberName = NameConverter.ConvertName(instance.Member.Name); var entityName = NameConverter.ConvertName(instance.EntityType.Name); var childTypeName = NameConverter.ConvertName(instance.ChildType.Name); var tableName = string.CompareOrdinal(entityName, childTypeName) < 0 ? string.Format(CultureInfo.InvariantCulture, "{0}_{1}", entityName, childTypeName) : string.Format(CultureInfo.InvariantCulture, "{0}_{1}", childTypeName, entityName); var keyName = string.Format(CultureInfo.InvariantCulture, "fk_{0}_{1}", memberName, entityName); var otherKeyName = string.Format(CultureInfo.InvariantCulture, "fk_{0}_{1}", entityName, memberName); var columnName = string.Format(CultureInfo.InvariantCulture, "{0}_id", entityName); var otherColumnName = string.Format(CultureInfo.InvariantCulture, "{0}_id", childTypeName); instance.Table(tableName); instance.Key.Column(columnName); instance.Key.ForeignKey(keyName); instance.Relationship.Column(otherColumnName); instance.Relationship.ForeignKey(otherKeyName); }
public static string ConvertToCustomName(string propertyName) { var result = string.Format(CultureInfo.InvariantCulture, "{0}", NameConverter.ConvertName(propertyName)); return(result); }
public override string GetComponentColumnPrefix(Member member) { var result = NameConverter.ConvertName(member.Name) + "_"; return(result); }
public void Apply(IClassInstance instance) { instance.Table(string.Format(CultureInfo.InvariantCulture, "{0}", NameConverter.ConvertName(instance.EntityType.Name))); }