Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
SuggestionRe: C# and ODATA CRUD communication with D365BC web service Pin
Richard Deeming12-Mar-20 1:12
mveRichard Deeming12-Mar-20 1:12 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
clemenslinders12-Mar-20 3:48
clemenslinders12-Mar-20 3:48 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
Richard Deeming12-Mar-20 4:29
mveRichard Deeming12-Mar-20 4:29 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
clemenslinders12-Mar-20 4:54
clemenslinders12-Mar-20 4:54 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
Richard Deeming12-Mar-20 5:43
mveRichard Deeming12-Mar-20 5:43 
GeneralRe: C# and ODATA CRUD communication with D365BC web service Pin
clemenslinders12-Mar-20 21:25
clemenslinders12-Mar-20 21:25 
QuestionC# code -Compare 2 pdf and give output as 2 pdfs with color Pin
Member 1476942610-Mar-20 20:13
Member 1476942610-Mar-20 20:13 
AnswerRe: C# code -Compare 2 pdf and give output as 2 pdfs with color Pin
OriginalGriff10-Mar-20 20:49
mveOriginalGriff10-Mar-20 20:49 
AnswerRe: C# code -Compare 2 pdf and give output as 2 pdfs with color Pin
Maciej Los10-Mar-20 21:25
mveMaciej Los10-Mar-20 21:25 
JokeRe: C# code -Compare 2 pdf and give output as 2 pdfs with color Pin
Richard Deeming11-Mar-20 0:37
mveRichard Deeming11-Mar-20 0:37 
GeneralRe: C# code -Compare 2 pdf and give output as 2 pdfs with color Pin
kalberts12-Mar-20 3:01
kalberts12-Mar-20 3:01 
Questiontime requirements in real-times systems? Pin
auting8210-Mar-20 3:08
auting8210-Mar-20 3:08 
AnswerRe: time requirements in real-times systems? Pin
OriginalGriff10-Mar-20 3:49
mveOriginalGriff10-Mar-20 3:49 
GeneralRe: time requirements in real-times systems? Pin
auting8210-Mar-20 4:43
auting8210-Mar-20 4:43 
GeneralRe: time requirements in real-times systems? Pin
OriginalGriff10-Mar-20 4:51
mveOriginalGriff10-Mar-20 4:51 
AnswerRe: time requirements in real-times systems? Pin
Gerry Schmitz10-Mar-20 6:30
mveGerry Schmitz10-Mar-20 6:30 
AnswerRe: time requirements in real-times systems? Pin
Richard MacCutchan10-Mar-20 7:02
mveRichard MacCutchan10-Mar-20 7:02 
Questionimport multiple csv files into msql database - C# coding - reg Pin
Member 137889379-Mar-20 7:28
Member 137889379-Mar-20 7:28 
AnswerRe: import multiple csv files into msql database - C# coding - reg Pin
phil.o9-Mar-20 8:25
professionalphil.o9-Mar-20 8:25 
QuestionHow to invoke Web API in console or service application? Pin
meeram399-Mar-20 3:38
professionalmeeram399-Mar-20 3:38 
AnswerRe: How to invoke Web API in console or service application? Pin
Richard Deeming9-Mar-20 8:45
mveRichard Deeming9-Mar-20 8:45 
GeneralRe: How to invoke Web API in console or service application? Pin
meeram399-Mar-20 17:48
professionalmeeram399-Mar-20 17:48 
GeneralRe: How to invoke Web API in console or service application? Pin
Richard Deeming10-Mar-20 0:32
mveRichard Deeming10-Mar-20 0:32 
QuestionConverting List<int> to List<object> for One to Many relation with sqlite-net-extensions Pin
Exoskeletor8-Mar-20 0:00
Exoskeletor8-Mar-20 0:00 
<pre>
Im creating a Xamarin.Android app and for database im using sqlite-net. I was trying to create a table with this structure

public class Templates
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public int Category { get; set; }
[TextBlob("imagesBlobbed")]
public List<int> Images { get; set; }
public string imagesBlobbed { get; set; }
}
but i want every time im adding a template to check if it already exist by checking the Images like this:

public static void AddTemplate(SQLiteConnection db, int category, List<int> images)
{
var alreadyExist = db.Table<templates>().Where(record => record.Images == images);

if (alreadyExist?.Count() == 0)
{
var template = new Templates()
{
Category = category,
Images = images,
};
db.InsertWithChildren(template, recursive: true);
}
}
but it's not working and i'm guessing it is not working because you cannot query with parameter "Images", in the database is stored as a blob. So im guessing i have to convert List to something else that is more easily supported in sqlite.

I'm thinking of using sqlite-net-extensions that support one to many relations and do something like this:

[Table("Templates")]
public class Template
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public int Category { get; set; }
[OneToMany]
public TemplateImage Images { get; set; } = new List<int>();
}
[Table("TemplateImages")]
public class TemplateImage
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public int Image1 { get; set; }
public int Image2 { get; set; }
public int Image3 { get; set; }
public int Image4 { get; set; }
public int Image5 { get; set; }
[ForeignKey(typeof(Template))]
public int TemplateId { get; set; }
}
In my application every template has 5 images, but this might change in the future. What is the correct approach according to DB design, to have a TemplateImage object with 5 images or to have only one image for every TemplateImage object like this:

[Table("Templates")]
public class Template
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public int Category { get; set; }
[OneToMany]
public List<templateimage> Images { get; set; } = new List<int>();
}
[Table("TemplateImages")]
public class TemplateImage
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public int Image { get; set; }
[ForeignKey(typeof(Template))]
public int TemplateId { get; set; }
}
Is the second approach slower? Is there any other better way for this?
AnswerRe: Converting List<int> to List<object> for One to Many relation with sqlite-net-extensions Pin
Eddy Vluggen8-Mar-20 9:20
professionalEddy Vluggen8-Mar-20 9:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.