Dailycode.info

Short solution for short problems

AngularJS: How to build your own translation service PART 2

Ruben continued on the translation service blog resulting in a language picker that translates your entire site. You can find the post here:

How to – Build your own Angular translation service – Part 2 

Looking forward to PART 3 where Ruben B from Spikes will show how to implement json files to handle the translations, this way you can get the text from "any" data source.


AngularJS: How to build your own translation service

Ruben Biesemans started a post on how to implement your own translation service. Why you might ask. For him mainly educational purpose, for us, it's an opportunity to have a guideline on how to build your own translation service. Because many might find the existing solutions to complex or just not flexible enough. Here's a link to the part 1 and looking forward to the next part.

How to – Build your own Angular translation service – Part 1

spikesapps.wordpress.com

Intro This will be a first in a series of posts in which I will build a translation service for Angular from the ground up. I want to point out up front that I know there are multiple angular trans… read more here


EF : Oracle and EF Code First “Invalid column name 'Discriminator'”

I got this little nasty error when working with EF6 and Oracle DB: ORA-00904: "Extent1"."Discriminator"

Didn't look that far, based on this post I found my answer!

I had a class: Clients, added to the context. 

That worked fine. 

Now I created a second class, ClientExtra not added to the context but this inherited from the Client object.

(Why you might ask, I used this class in a database query, it had some extra properties and no table reflecting in the already exiting DB)

After doing this, EF gave me the above error.

It could look like this:

public class Client
{
    public int Id { get; set; }

    public string Name { get; set; }
}

public class ClientExtra : Client
{
    public string City { get; set; }
}

Solution

First create a common base class, ClientBase, add all properties from the client object. Do not add the ClientBase to the context. Then you have Client en ClientExtra inherit from this base class without problems.

public class BaseClient
{
    public int Id { get; set; }

    public string Name { get; set; }
}

//In the context
public class Client : BaseClient
{ }

//Not in the context
public class ClientExtra : BaseClient
{
    public string City { get; set; }
}